<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Haseeb</title>
    <description>The latest articles on DEV Community by Haseeb (@haseebelaahi).</description>
    <link>https://dev.to/haseebelaahi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F166205%2Ff4bcd2b4-d219-462d-8e45-77d0df8165c6.jpg</url>
      <title>DEV Community: Haseeb</title>
      <link>https://dev.to/haseebelaahi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/haseebelaahi"/>
    <language>en</language>
    <item>
      <title>Understanding PWAs - Exploring the Twitter PWA with Dev Tools</title>
      <dc:creator>Haseeb</dc:creator>
      <pubDate>Sat, 10 Apr 2021 23:43:53 +0000</pubDate>
      <link>https://dev.to/haseebelaahi/understanding-pwas-exploring-the-twitter-pwa-with-dev-tools-14ji</link>
      <guid>https://dev.to/haseebelaahi/understanding-pwas-exploring-the-twitter-pwa-with-dev-tools-14ji</guid>
      <description>&lt;p&gt;&lt;strong&gt;PWAs (Progressive Web Apps)&lt;/strong&gt; have been around for quite some time now. With time the PWA developer ecosystem and browser support has become mature and most of the top web platforms are now starting to add PWA support to their web apps. So what exactly is a PWA?&lt;/p&gt;

&lt;p&gt;MDN's under construction PWA &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps"&gt;page&lt;/a&gt; defines a PWA as&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Progressive Web Apps are web apps that use emerging web browser APIs and features along with traditional progressive enhancement strategy to bring a native app-like user experience to cross-platform web applications. Progressive Web Apps are a useful design pattern, though they aren't a formalized standard."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If this definition is too vague or broad for you, you can safely assume that PWAs are web apps which run in the browser but can be "installed" on the user's smartphone or computer to provide a native app like behavior but in the browser. Generally, some offline functionality or graceful application behavior without network connectivity is expected from PWAs.&lt;/p&gt;

&lt;p&gt;To better understand how PWAs are implemented and what better experience this web application design pattern provides, let's try to dig into and reverse engineer the Twitter PWA using the Chrome Dev Tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Manifest 📜
&lt;/h2&gt;

&lt;p&gt;If your web app is going to be "installed" it needs to have some metadata, e.g the app's name, icons for different resolutions and a url to which the app opens to by default. All of this information is added in a json file present at the &lt;code&gt;/manifest.json&lt;/code&gt; path.&lt;/p&gt;

&lt;p&gt;Here is a screenshot of the Twitter's &lt;code&gt;manifest.json&lt;/code&gt; file. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--H_f_2zoz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jb2cv1zguuesp4waft4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--H_f_2zoz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jb2cv1zguuesp4waft4z.png" alt="Screenshot of Twitter PWA manifest.json file"&gt;&lt;/a&gt;&lt;br&gt;
You can see the detail you can provide and the support for the possible interoperability of the Twitter Android native and the PWA app using the &lt;code&gt;android_package_name&lt;/code&gt; property. Pretty powerful and feature rich!&lt;br&gt;
Read more about the manifest file and what it can support &lt;a href="https://web.dev/add-manifest/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Service Worker 🧑‍🏭
&lt;/h2&gt;

&lt;p&gt;The ❤️ of PWA - &lt;code&gt;service worker&lt;/code&gt; is a JS script that lives separate from the browser page. Among other features, it provides a &lt;em&gt;network proxy&lt;/em&gt; for the web page it is running for. This means every network request originating from that page passes through the &lt;code&gt;service worker&lt;/code&gt;. This opens up possibilities and provides more control over resource caching, offline application behavior and requests for resources or API calls that are sent to the server. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XLeHxxPO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ppwrxdqpinwbdvzm6al3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XLeHxxPO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ppwrxdqpinwbdvzm6al3.png" alt="Twitter Service Worker Chrome Dev Tools Screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Twitter &lt;code&gt;service worker&lt;/code&gt; is registered under the &lt;code&gt;https://twitter.com/&lt;/code&gt; path which means it will work as &lt;code&gt;service worker&lt;/code&gt; for all paths under the &lt;code&gt;twitter.com&lt;/code&gt; host. Service workers once installed against a web app keep running even when you navigate away from the page and become active every time user goes to the URL for which a &lt;code&gt;service worker&lt;/code&gt; is registered in the browser. Read more about the lifecycle, features and nuances of service workers &lt;a href="https://developers.google.com/web/fundamentals/primers/service-workers"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Cache Storage 🛍️
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Cache Storage&lt;/code&gt; &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/CacheStorage"&gt;Web API&lt;/a&gt; provides a simple way to implement caching of resources in the browser. It is important not to confuse this API with the default browser caching implemented by default.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BxQ70xIJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/afpc9unsncwysf6mpmye.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BxQ70xIJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/afpc9unsncwysf6mpmye.png" alt="Twitter Cache Storage Chrome Dev Tools Screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see there is a list of js files stored in the cache storage and each one of them has a path in the &lt;code&gt;name&lt;/code&gt; field. Remember when we said that the &lt;code&gt;service worker&lt;/code&gt; acts as a network proxy for the page. This means every request for these js resources originating from &lt;code&gt;twitter.com&lt;/code&gt; first passes through the &lt;code&gt;service worker&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;The &lt;code&gt;service worker&lt;/code&gt; is implemented in such a way that for every resource request it first checks if the resource is present in the cache storage. If it is, the page is sent a &lt;code&gt;200 OK&lt;/code&gt; response along with the required resource, without ever hitting the &lt;code&gt;twitter.com&lt;/code&gt; servers. You can see a live demo of it in the Network console.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iIEcamAx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kruzgw2nqvtr1foed6n7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iIEcamAx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kruzgw2nqvtr1foed6n7.png" alt="Network Tab screenshot for twitter.com"&gt;&lt;/a&gt;&lt;br&gt;
As you can see in this screenshot, for the js resource &lt;code&gt;bundle.HomeTimeline...js&lt;/code&gt; the request never hits the servers and the &lt;code&gt;twitter.com&lt;/code&gt; page still gets the &lt;code&gt;200 OK&lt;/code&gt; response along with the script.&lt;/p&gt;

&lt;p&gt;Similarly, the HTML skeleton/shell of the Twitter app is also cached.&lt;/p&gt;

&lt;p&gt;Even if there is no internet connection, the Twitter web app's HTML and JS will be served to the page from the &lt;code&gt;Cache Storage&lt;/code&gt; by the &lt;code&gt;Service Worker&lt;/code&gt;, making the app resilient to slow or no internet connectivity.&lt;/p&gt;

&lt;h2&gt;
  
  
  IndexedDB 💾
&lt;/h2&gt;

&lt;p&gt;Another one of the emerging web browser API that PWAs use is the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API"&gt;IndexedDB API&lt;/a&gt;. The IndexedDB is an interface for storing and accessing structured data within the browser. &lt;/p&gt;

&lt;p&gt;Twitter makes interesting use of this feature for optimizing user experience by storing different kinds of less frequently changing metadata for the logged in user and some recent user activity so that it can be fetched directly from within the browser when needed.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--59sNmhbi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/waoztkevjc1v84y7ibdg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--59sNmhbi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/waoztkevjc1v84y7ibdg.png" alt="Twitter IndexedDB Chrome Devtools screenshot"&gt;&lt;/a&gt;&lt;br&gt;
A quick look under the &lt;code&gt;IndexedDB&lt;/code&gt; category for &lt;code&gt;twitter.com&lt;/code&gt; shows multiple IndexedDB instances, some with only a single Object store, some with multiple.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iV1k9-tk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f742kprnail04edj3vrn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iV1k9-tk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f742kprnail04edj3vrn.png" alt="Twitter IndexedDB Chrome Devtools screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Expanding in and looking at the contents of one of the DBs with an object store called &lt;code&gt;keyvaluepairs&lt;/code&gt; we can see that it has stored a list of my recently used emojis on Twitter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gqxfjGmg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/msfsoo04rvf98zxhtjfy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gqxfjGmg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/msfsoo04rvf98zxhtjfy.png" alt="Twitter IndexedDB Chrome Devtools screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Object store in the DB with the identifier &lt;code&gt;localforge&lt;/code&gt; contains some more metadata about the user.&lt;/p&gt;

&lt;p&gt;This kind of data could have been stored using good old &lt;code&gt;Local Storage&lt;/code&gt; but newer features like &lt;code&gt;IndexedDB&lt;/code&gt; are meant to server as an objectstore database for your application right within the browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing the Twitter PWA ⬇️
&lt;/h2&gt;

&lt;p&gt;You can use a little button in the Chrome browser URL field to install the PWA as an app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vOec_79U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ro3jge6heent87lrq4b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vOec_79U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ro3jge6heent87lrq4b.png" alt="Twitter PWA installation Screenshot"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once installed, you now have a Twitter app icon in your dock/task bar and the app opens in a separate window different from your browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--97-0Q7B6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bsk92ctpbl7yy6pkfozu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--97-0Q7B6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bsk92ctpbl7yy6pkfozu.png" alt="Twitter PWA installed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Offline Test 🚫
&lt;/h2&gt;

&lt;p&gt;Let's see what happens if I turn off my network and try opening the newly installed Twitter PWA. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IygW4dyD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzr6o5swxr6jrzlyugdd.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IygW4dyD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wzr6o5swxr6jrzlyugdd.gif" alt="Gif showing the behavior of Twitter PWA when offline"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see, the app's UI gets loaded. Most of the navigations work, but no tweets or trends data is loaded. It is &lt;strong&gt;important&lt;/strong&gt; to understand:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The UI works because the app's HTML and CSS are in &lt;code&gt;Cache Store&lt;/code&gt; and are being served through the &lt;code&gt;service worker&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;The interactions and navigations work because the JS implementing those is also stored in &lt;code&gt;Cache Store&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The profile page shows some of the user metadata, which means that data is stored somewhere maybe in the IndexedDB from which the app is fetching it rather than the API.&lt;/li&gt;
&lt;li&gt;As the installed Twitter app is actually only a separate Chrome instance which only goes to &lt;code&gt;https://twitter.com&lt;/code&gt;, but we are not seeing the 'No Internet Connection' page with a trex because the &lt;code&gt;Service Worker&lt;/code&gt; is acting as a &lt;em&gt;network proxy&lt;/em&gt; and still serving content and responding to the network requests of the &lt;code&gt;twitter.com&lt;/code&gt; page even without a connection to the Twitter servers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Phew you reached the end! Hopefully, you learned something new. If you want to ask a question, leave your thoughts about PWAs or you think there's a mistake in the article above, I'll be glad to hear from you in the comments below. You can also reach out to me on Twitter &lt;a href="https://twitter.com/haseebelaahi"&gt;@haseebelaahi&lt;/a&gt;&lt;/em&gt; 🙂&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>performance</category>
      <category>pwa</category>
    </item>
    <item>
      <title>What would this JS code print? 🤔</title>
      <dc:creator>Haseeb</dc:creator>
      <pubDate>Mon, 09 Mar 2020 18:51:44 +0000</pubDate>
      <link>https://dev.to/haseebelaahi/what-would-this-js-code-print-4cd1</link>
      <guid>https://dev.to/haseebelaahi/what-would-this-js-code-print-4cd1</guid>
      <description>&lt;p&gt;What do you think this piece of code will print? Most of you might know the answer but the behavior is really interesting to me and got me thinking and learning about a very important concept in JS.&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function saySomething() {
    var greeting = "Hello";
    {
        greeting = "Howdy";
        let greeting = "Hi";
        console.log(greeting);
    }
}
saySomething(); //what would this print?
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

</description>
      <category>discuss</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How to Work with a Not so Perfect Codebase - Based on My Experience of Working in One!</title>
      <dc:creator>Haseeb</dc:creator>
      <pubDate>Thu, 25 Jul 2019 19:10:07 +0000</pubDate>
      <link>https://dev.to/haseebelaahi/how-to-work-with-a-not-so-perfect-codebase-based-on-my-experience-of-working-in-one-3pb1</link>
      <guid>https://dev.to/haseebelaahi/how-to-work-with-a-not-so-perfect-codebase-based-on-my-experience-of-working-in-one-3pb1</guid>
      <description>&lt;p&gt;There is a good chance that at some point in our careers we find ourselves working in a &lt;strong&gt;difficult&lt;/strong&gt;, &lt;strong&gt;not-so-perfect&lt;/strong&gt; codebase. Maybe the code was initially written for an MVP with hacky code but now you have a &lt;em&gt;full-fledged product&lt;/em&gt; built on top of it, maybe the code was maintained for years by a number of people without a proper code owner and &lt;em&gt;code review&lt;/em&gt; process and now it is just &lt;em&gt;thousands&lt;/em&gt; of lines of code that nobody is there to own, maybe the requirements changed so &lt;em&gt;dramatically&lt;/em&gt; that most of the already written code became &lt;em&gt;obsolete&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;If you become part of a team which is dealing with a scenario similar to any of those mentioned above or in general you are dealing with a codebase that is not very &lt;em&gt;readable&lt;/em&gt;, &lt;em&gt;consistent&lt;/em&gt; and &lt;em&gt;easy to tread through&lt;/em&gt;, I have tried to put out a short list about how to manage through, bring sanity and actually actively improve such codebases along with developing features according to business requirements - &lt;strong&gt;based on my experience with working on one such codebase&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Acknowledge the Issues 🔧
&lt;/h2&gt;

&lt;p&gt;After every member of the team has spent some time with the codebase, the first thing you want to do is to have a discussion among your team with everyone sharing their opinion and acknowledging the issues that exist with the current architecture, the way the code is written, the practices that are followed or the lack of such practices.&lt;br&gt;
It is important to have all members of the team on the same page about &lt;strong&gt;what is wrong&lt;/strong&gt; and &lt;strong&gt;what needs to be fixed&lt;/strong&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Tackle One Problem at a Time 🔨
&lt;/h2&gt;

&lt;p&gt;Do not try to fix everything in one night! When it took &lt;em&gt;years&lt;/em&gt; to get there, it is going to take you some time to fix it. &lt;br&gt;
Identify parts of the application or specific modules that need improvement, decide how much every area is &lt;strong&gt;critical&lt;/strong&gt; to your operation and &lt;strong&gt;prioritize&lt;/strong&gt; accordingly.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Respect the Business Objectives 💰
&lt;/h2&gt;

&lt;p&gt;Most of the products/projects developed in professional settings contribute towards helping a business achieve its goals. For an organization, achieving those business goals is the first and foremost priority. &lt;br&gt;
As a developer, we need to respect those business objectives and make sure our quest to &lt;strong&gt;'improve'&lt;/strong&gt; the code doesn't come in the way of achieving our business's goals. Always remember when you are there to cross the swamp and when to fight the alligators 🐊 (&amp;lt;-- I know this is a crocodile)&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1144647007627284481-553" src="https://platform.twitter.com/embed/Tweet.html?id=1144647007627284481"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1144647007627284481-553');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1144647007627284481&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;p&gt;Showing respect for the business objectives also helps you build a relationship of &lt;strong&gt;trust&lt;/strong&gt; with the product requirement and specifications teams. This will help you get more time assigned to &lt;strong&gt;cleaning things up&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe class="tweet-embed" id="tweet-1145052576167186433-190" src="https://platform.twitter.com/embed/Tweet.html?id=1145052576167186433"&gt;
&lt;/iframe&gt;

  // Detect dark theme
  var iframe = document.getElementById('tweet-1145052576167186433-190');
  if (document.body.className.includes('dark-theme')) {
    iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=1145052576167186433&amp;amp;theme=dark"
  }



&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Establish a Code Review Process 👀 👀
&lt;/h2&gt;

&lt;p&gt;Once you have agreed that you need to improve the codebase, the next step you want to do is to have a code review process. It is always better to put &lt;strong&gt;multiple sets of eyes&lt;/strong&gt; on every piece of code that gets checked in. It is not necessary to have a senior resource review the code, initially, you could just start by &lt;strong&gt;peer-reviewing&lt;/strong&gt;. This will also help the team eventually get familiar with different parts of the codebase.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Integrate Refactoring in Your Regular Bug Fixing/Feature Delivery ⬆️ ⬇️
&lt;/h2&gt;

&lt;p&gt;Sometimes it becomes very hard for developers to get dedicated time assigned for &lt;strong&gt;code refactoring&lt;/strong&gt; specifically especially in small to medium-sized projects with limited resources. &lt;br&gt;
Continue your little &lt;em&gt;&lt;strong&gt;operation cleanup&lt;/strong&gt;&lt;/em&gt; along with every task, bug fix or feature you check into the code. This way every part of the code that gets touched will keep getting &lt;strong&gt;cleaned up&lt;/strong&gt; without putting a &lt;strong&gt;significant&lt;/strong&gt; effort at once.&lt;/p&gt;

&lt;p&gt;All of my observations come as a junior engineer with 2 years of experience only, spending about a year with one such codebase and seeing it improve with each passing day. My opinions could also be biased only by the kind of teams and projects I have worked on.&lt;/p&gt;

&lt;p&gt;Devs trying to find their way through such codebases, what do you guys think of this? Senior, more seasoned guys who have years of experience doing this correct me if I'm wrong or want to add something!&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>programming</category>
      <category>beginners</category>
      <category>career</category>
    </item>
    <item>
      <title>What Not to Do as a Programmer - My List After 2 Years of Working In Teams</title>
      <dc:creator>Haseeb</dc:creator>
      <pubDate>Fri, 19 Jul 2019 05:07:41 +0000</pubDate>
      <link>https://dev.to/haseebelaahi/what-not-to-do-as-a-programmer-my-list-after-2-years-of-working-with-teams-1b23</link>
      <guid>https://dev.to/haseebelaahi/what-not-to-do-as-a-programmer-my-list-after-2-years-of-working-with-teams-1b23</guid>
      <description>&lt;p&gt;There is a lot of content out there discussing what you need to do to become a good programmer. What concepts you need to understand, what technologies you need to learn, what tools you have to know, etc. When I joined the tech industry 2 years ago with dreams of being a great programmer who will change the world with code one semi-colon at a time, I had a mental list of what I need to learn in order to be an awesome dev. Over time I have learned that there should've been a list of what &lt;em&gt;not&lt;/em&gt; to do as a &lt;strong&gt;programmer&lt;/strong&gt;, &lt;strong&gt;dev&lt;/strong&gt;, &lt;strong&gt;software engineer&lt;/strong&gt;/&lt;strong&gt;ninja&lt;/strong&gt; or whatever you call yourself.&lt;/p&gt;

&lt;p&gt;I'm trying to put together a list here to keep reminding myself and for those who have just started their careers or are going to, soon!&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Do Not Fall In Love ❤️ With Your Code
&lt;/h2&gt;

&lt;p&gt;The number 1 mistake a lot of devs make at the start of their careers is treating their code like their &lt;em&gt;babies&lt;/em&gt; or &lt;em&gt;pets&lt;/em&gt;. &lt;br&gt;
Sure, we all love our work but always remember what your end goal is, to write good code and collectively contribute to making the product/project you are working on better every day.&lt;br&gt;
When you don't attach your feelings with the code you write, there is a better chance you'll always try to make it better and not let your feelings come in way of &lt;strong&gt;improving&lt;/strong&gt; it.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Do Not Try to Learn Everything 📖
&lt;/h2&gt;

&lt;p&gt;The kind of business we are involved in, there is always something new around, that new &lt;em&gt;JS&lt;/em&gt; framework, a new library or another new productivity tool. &lt;br&gt;
Do not lose your focus by thinking that you need to be expert in every tool and technology that is around. Keep exploring and trying out new technologies and stacks but always keep your focus on something &lt;strong&gt;particular&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Do Not Worship Frameworks &amp;amp; Languages💎
&lt;/h2&gt;

&lt;p&gt;Sure keep your focus on something particular but at the start of your career do not try to put a label on yourself. Do not call yourself a &lt;em&gt;ROR Engineer&lt;/em&gt; or a &lt;em&gt;React Developer&lt;/em&gt;. Sure you work on &lt;em&gt;React&lt;/em&gt; but do not let that define &lt;strong&gt;you&lt;/strong&gt;. Frameworks and languages will come &amp;amp; go, you are here to stay!&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Do Not Feel Proud if your Team Depends Heavily on You 👦
&lt;/h2&gt;

&lt;p&gt;One thing I always thought of something to be proud of was doing a lot of heavy lifting in a team. I always thought the best programmer would be the one without whom the team will not be able to function. Do not try to be that guy! Teams that have a &lt;em&gt;uniform&lt;/em&gt; distribution of responsibility and workload are less prone to failures and crisis. Always try to enable other members of your team and not keep the knowledge and expertise to yourself. Do not try to be that &lt;strong&gt;hero&lt;/strong&gt; who's always there to save the day!&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Do Not Mind 😠 Negative Feedback
&lt;/h2&gt;

&lt;p&gt;Always assume that other people who work with you want to see a better self of yours. Do not take &lt;strong&gt;criticism&lt;/strong&gt; or &lt;strong&gt;negative feedback&lt;/strong&gt; from your coworkers as a personal attack on you. Listen to the feedback, &lt;em&gt;contemplate&lt;/em&gt; and try to improve.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Do Not Keep Complaining ⁉️
&lt;/h2&gt;

&lt;p&gt;Always try to take initiative rather than complaining. Realize the fact that even as a young or junior dev you are now part of the team. Do not act as an outsider who keeps complaining rather take &lt;strong&gt;initiative&lt;/strong&gt; and suggest options to make things better.&lt;br&gt;
&lt;em&gt;Note: This does not apply at all in case of abusive, threatening, discriminating or harassing behavior. Do not wait a moment to report any such behaviors.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Do Not Point Fingers 👉
&lt;/h2&gt;

&lt;p&gt;If something goes wrong e.g a &lt;em&gt;deployment&lt;/em&gt; fails, bad code gets into &lt;em&gt;master&lt;/em&gt; or a &lt;em&gt;server&lt;/em&gt; breaks down, do not start pointing fingers at individuals. Teams operate as &lt;strong&gt;collective&lt;/strong&gt; entities and take responsibilities as &lt;strong&gt;groups&lt;/strong&gt;. Sure, you want to find out what went wrong but that does not mean you single out individuals and blame them.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Do Not Remove Your Work-Life 👪 Boundaries
&lt;/h2&gt;

&lt;p&gt;Keep in mind that you have a life outside of your profession. Do not let being a programmer come in way of having quality time with your family, quietly reading a book or going on a vacation.&lt;/p&gt;

&lt;p&gt;All of my observations come as a junior engineer with 2 years of experience only. My opinions could also be biased only by the kind of teams and people I have worked with. &lt;/p&gt;

&lt;p&gt;Junior devs working in teams early in their careers, what do you guys think of this? Senior, more seasoned guys correct me if I'm wrong or want to add something!&lt;/p&gt;

&lt;p&gt;Edit: There are some brilliant new points and discussion on these in the comments section. Please go through those as well, happy coding :)&lt;/p&gt;

</description>
      <category>career</category>
      <category>beginners</category>
      <category>discuss</category>
      <category>devlive</category>
    </item>
    <item>
      <title>What I Found When I Went Through My Facebook Location Data</title>
      <dc:creator>Haseeb</dc:creator>
      <pubDate>Fri, 03 May 2019 22:19:14 +0000</pubDate>
      <link>https://dev.to/haseebelaahi/what-i-found-when-i-went-through-my-facebook-location-data-89j</link>
      <guid>https://dev.to/haseebelaahi/what-i-found-when-i-went-through-my-facebook-location-data-89j</guid>
      <description>&lt;p&gt;&lt;em&gt;Some visualizations and stats on my facebook location data and the results, well you could say are not very pleasant.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S2TwPhsP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AF3Qw3lQbqcTK5xP64F_dcw.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S2TwPhsP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AF3Qw3lQbqcTK5xP64F_dcw.jpeg" alt=""&gt;&lt;/a&gt;Image Source: &lt;a href="http://www.cpomagazine.com"&gt;&lt;/a&gt;&lt;a href="http://www.cpomagazine.com"&gt;www.cpomagazine.com&lt;/a&gt; CPO Magazine&lt;/p&gt;

&lt;p&gt;For some time Facebook has been allowing users to download the data it has on them, so one curious night I went ahead and downloaded all of my location data that Facebook has.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F_o_3Sc_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AtkbyxMYY69-yfg3rVlc6bQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F_o_3Sc_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AtkbyxMYY69-yfg3rVlc6bQ.png" alt=""&gt;&lt;/a&gt;Screen Capture: Facebook, Download Your Information Page&lt;/p&gt;

&lt;p&gt;Facebook allows you to download your data as browser viewable HTML, but that view isn’t really interesting and doesn’t reveal much (as Facebook would probably want 🤷‍♂️). The HTML view just gives you a boring list of coordinates like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tD3vNwn2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AsoQh7xPvDrB0k_uONdzFkA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tD3vNwn2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AsoQh7xPvDrB0k_uONdzFkA.png" alt=""&gt;&lt;/a&gt;Screen Capture: Facebook User Location Data&lt;/p&gt;

&lt;p&gt;I downloaded the data in JSON which is another of the supported formats and did some basic stats &amp;amp; visualizations.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I have been a Facebook user since 2011 but started using the Facebook app on my phone 3–4 years later. All of the stats and visualizations here are from location data ranging from January 2015–April 2019.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Number of Times Facebook Stored My Location&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Facebook accessed and stored my location for a total of &lt;strong&gt;2818&lt;/strong&gt; times in the period from &lt;em&gt;start of 2015 to April of 2019&lt;/em&gt; averaging almost &lt;strong&gt;650 times a year&lt;/strong&gt; , &lt;strong&gt;54 times a month&lt;/strong&gt; 🙀 or &lt;strong&gt;twice every day&lt;/strong&gt; 😮. When you think about these numbers for a moment, it almost feels like basically being tracked literally all the time!&lt;/p&gt;

&lt;h3&gt;
  
  
  Stored Locations By Year
&lt;/h3&gt;

&lt;p&gt;Facebook’s location collection seems to be tied with how often your location changes and obviously having your phone’s location turned on is a prerequisite. This graph shows a trend of location entries by each year.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hOm_r0bu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AAYEVAoQwzEWa583w2c7ODQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hOm_r0bu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AAYEVAoQwzEWa583w2c7ODQ.png" alt=""&gt;&lt;/a&gt;My location data on Facebook by year&lt;/p&gt;

&lt;p&gt;The reason for the huge spike in data collection from 2016 to 2017 is maybe due to some change in Facebook’s location collection policy or probably I just bought a good smartphone in 2017 and started having the location turned on all the time on my Android smartphone.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Busiest Location Collection Days&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Digging deeper into the data, I went ahead and filtered out the ten days which had the highest location collection frequency. Can you guess how many times at maximum my location got stored on Facebook on any given day?&lt;/p&gt;

&lt;p&gt;50, 100? Nope, &lt;strong&gt;Two Hundred and Thirty-Eight&lt;/strong&gt; times!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Du0zZ1iy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AeXbaCvvNeb6LhsaQuB6q8w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Du0zZ1iy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2AeXbaCvvNeb6LhsaQuB6q8w.png" alt=""&gt;&lt;/a&gt;Top 10 Highest Location Collection Days&lt;/p&gt;

&lt;p&gt;Turns out I was traveling on that particular day and was on the road for the most part of my day and Facebook like any worried parent would do, checked on me for &lt;strong&gt;238&lt;/strong&gt;  times…&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;What would all of this data look like on a map?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Naturally I wanted to put all of this latitude and longitude data on an actual map to visualize where I have been moving around in all these years!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8eYdAaFq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ArrsvxcDsEtK1h0kK359tFA.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8eYdAaFq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/1024/1%2ArrsvxcDsEtK1h0kK359tFA.png" alt=""&gt;&lt;/a&gt;My location data from Facebook on my hometown’s map&lt;/p&gt;

&lt;p&gt;So this above is a visual representation of my location data that Facebook has almost in a 15km radius of my house in my hometown (Lahore, PK). Each blue dot represents one instance of a location captured and stored by Facebook.&lt;/p&gt;

&lt;p&gt;For some of the locations marked here I didn’t even remember visiting that area but thanks to Facebook for providing hard evidence I recalled &lt;strong&gt;_everywhere I’ve been in the past 4 years _&lt;/strong&gt; 🙃&lt;/p&gt;

&lt;p&gt;With the location data, timings for each location capture and Facebook’s resources it is very easy to infer any Facebook app user’s home address, workplace, where do they go on weekends regularly, which restaurants they eat at and so on. &lt;strong&gt;&lt;em&gt;All of this definitely makes targeting ads easier and of course classifying specific user personas for political and social purposes&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Considering the latest speculation about Facebook launching a dating service of their own, this data could be of a lot more use in &lt;em&gt;“&lt;/em&gt;👫 &lt;em&gt;bringing people together”!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So, next time when you meet someone and the next thing is that they start appearing in your ‘&lt;em&gt;Suggested Friends&lt;/em&gt;’ list don’t get surprised 😆&lt;/p&gt;

&lt;p&gt;You can find detailed analysis on my Facebook data here on Kaggle&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.kaggle.com/helahi/facebook-messages-analysis"&gt;https://www.kaggle.com/helahi/facebook-messages-analysis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thank you for making it through! If you think I should dig in some more into this data to find any other stats or patterns, let me know in the comments!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>facebook</category>
      <category>location</category>
      <category>socialmedia</category>
      <category>privacy</category>
    </item>
  </channel>
</rss>
