<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by dilrajio on Medium]]></title>
        <description><![CDATA[Stories by dilrajio on Medium]]></description>
        <link>https://medium.com/@dilrajio?source=rss-137034955741------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*I1maDSOwGiyTQ9p0XvHx-g.png</url>
            <title>Stories by dilrajio on Medium</title>
            <link>https://medium.com/@dilrajio?source=rss-137034955741------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 05:04:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dilrajio/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Traditional Labels Are Better Than Floating Labels]]></title>
            <link>https://blog.devgenius.io/traditional-labels-are-better-than-floating-labels-b43b55c4e037?source=rss-137034955741------2</link>
            <guid isPermaLink="false">https://medium.com/p/b43b55c4e037</guid>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[a11y]]></category>
            <dc:creator><![CDATA[dilrajio]]></dc:creator>
            <pubDate>Mon, 03 May 2021 22:59:14 GMT</pubDate>
            <atom:updated>2021-10-28T00:34:18.933Z</atom:updated>
            <content:encoded><![CDATA[<h3>Regular Labels Are Better Than Floating Labels</h3><figure><img alt="Abstract art of an HTML floating label" src="https://cdn-images-1.medium.com/max/1024/1*CmRlRpYal0iKIfb-2vn1og.jpeg" /><figcaption>Made by moi, using a graphic art application on the iPad with a cheap stylus!</figcaption></figure><p>Let’s get straight into this. By now, we’ve all seen, used or built applications using Bootstrap or Material Design. Time and time again, I encourage developers to write vanilla CSS, but that doesn’t change the fact that these tools offer a consistent style, fast turnaround times for prototyping and a low barrier to entry among rising developers.</p><p>However, I see many people using them for building forms because they don’t like building forms and inputs. Forms are complex. They can become exceedingly long, but they become frustrating to use when they introduce friction; no matter how pretty they look. I’ve given a decent amount of #project-feedback, and #code-review on Nodiflux and similar Discord servers and I often see forms and inputs that look pretty but are in, some ways less functional.</p><h3>The Beauty of the Label</h3><p><strong>Labels are instructions</strong>. They provide a caption to an element, generally the input field that it manifests within.</p><p>There are additional “goodies” that come with the label element, which I will emphasize throughout this article.</p><ul><li>✅ Non-disappearing text</li><li>✅ Increased “hit-box” size. Effective for <strong>motor-impaired users</strong>.</li><li>✅ Native support with screen readers. Effective for<strong> visually-impaired users.</strong></li><li><strong>✅ </strong>They are <strong>obvious</strong></li></ul><h3>The Rise of The Placeholder</h3><p>Placeholders have gained a lot of attraction in the recent history of the web. They have a <em>minimal feel</em>; they generally save space. However, those are not good enough reasons to outright replace traditional labels, especially at the cost of perceived affordance. Here are some of those dangers:</p><p>The main reason you do not want to use a placeholder as a label is because the text disappears. Unless you built the application, <strong>disappearing text is hard to remember — </strong>however, there additional concerns.</p><p>Second, <strong>placeholders are NOT replacements for labels. They are hints. </strong>Hints are <strong>not</strong> mandatory. Hints are “nice-to-haves.” Placeholders that have critical requirements like: “<em>Must be 8 characters with at least 1 uppercase letter</em>” are poorly designed because<strong> of the problems that come with placeholders: </strong>:</p><ul><li>❌ Since placeholders <em>naturally </em>have lower contrast, we risk communicating important instructions to users. Your form must be 100% operational even if all the placeholders die.</li><li>❌ Long text will not fit in the placeholder</li><li>❌ Purposefully darkened placeholder text will make the input appear as if it is non-empty</li></ul><figure><img alt="Comparison of an HTML form with low contrast text and high contrast text." src="https://cdn-images-1.medium.com/max/1024/1*PGLhGVQ4CBprBYA0Vy0X3w.png" /><figcaption>Finding the balance between these two is a challenge. This example has been intentionally magnified. Website: <a href="https://www.hackerrank.com/auth/signup?h_l=body_middle_left_button&amp;h_r=sign_up">Hacker Rank</a></figcaption></figure><p>Which takes me to the problem number three: accessibility. Even with advancements in assistive technologies, at the time of writing, screen-readers are still unable to access the placeholder attribute.</p><p><strong>Bonus Note: </strong>It appears that <a href="https://www.w3.org/TR/html-aam-1.0/#input-type-text-input-type-password-input-type-search-input-type-tel-input-type-email-input-type-url-and-textarea-element-accessible-name-computation">the W3 has added placeholder to the spec.</a><strong> </strong>However, that does not change the fact that presently it may still be inaccessible. Read more here: <a href="https://github.com/dequelabs/axe-core/issues/2413#issuecomment-663194099">https://github.com/dequelabs/axe-core/issues/2413#issuecomment-663194099</a></p><h3>Floating Labels to the Rescue…?</h3><p>Floating labels were destined to be the answer. Users will now be able to:</p><ul><li>✅ See the “label” as they are typing</li><li>✅ Assistive technologies can access the input name</li><li>… use a <em>sleek </em>looking input?</li></ul><p>Let’s look at a practical case study:</p><figure><img alt="Floating label and traditional label form design comparison." src="https://cdn-images-1.medium.com/max/1024/1*HSjfb61K5NCrEVrhuSjJkg.png" /><figcaption>Play with it here on: <a href="https://codepen.io/dsomel21/pen/eYgqKaj?editors=1100">CodePen</a></figcaption></figure><p>On the left, we are making the presupposition that the label is <em>visible enough </em>that all users can read it, but only to the extent that it still appears empty. Again, we are walking on thin ice. With the example on the right, we can get away with putting lower contrast placeholder text because if it goes unseen, it won’t block the user. There is no critical information in the text.</p><p>Even though we discussed the potential risk of using “placeholders,” in the example above (on the right), we an excellent example of a “<em>nice-to-have” </em>hint.<em> </em>If users can access the placeholder, it will make their life easier when searching through paperwork and documents as they know what to look for. For example, the Driver’s License is a seven digit number, preceded by “DVID”. This makes it much easier to guess which number on the ID is the real Driver ID #.</p><p>However, by using floating labels, <strong>we have lost this opportunity entirely. </strong>Floating labels correspond 1:1 with the placeholder, meaning there is no place to give them that hint.</p><figure><img alt="Visual representation of hitbox sizes in a video game called, “Super Mario 64” (1996)" src="https://cdn-images-1.medium.com/max/1024/1*7075E76CKwoL5I_JYz9KmQ.png" /><figcaption>Source: <a href="https://www.youtube.com/watch?v=kRCjVLqjST">Walls, Floors, &amp; Ceilings Part 3</a> via YouTube —<a href="https://www.youtube.com/channel/UC5miyvhPsWWyfTulnJ43koQ"> UncommentatedPannen</a></figcaption></figure><p>If Super Mario 64 taught us anything, it’s to make use of <em>hit-box</em> sizes. Users of the web use these techniques (such as clicking on the label, to focus on the input) to their advantage, thus, we should also leverage that. Unfortunately, with the floating label, we’ve lost this.</p><h3>Conclusion</h3><p>The traditional label is far more superior than the floating labels. While floating labels aim to solve accessibility issues introduced with placeholders, they still do not outperform ordinary labels. I highly recommend giving Adam Silver’s <a href="https://www.smashingmagazine.com/2018/10/form-design-patterns-release/"><em>Form Design Patterns</em></a><em> </em>a read; I’ve <a href="https://twitter.com/dilrajio/status/1371267250775322625?s=20">Tweeted</a> about the beautiful book in the past, and it goes into even more depth on the challenges when building beautiful, accessible forms.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b43b55c4e037" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/traditional-labels-are-better-than-floating-labels-b43b55c4e037">Traditional Labels Are Better Than Floating Labels</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why The Farmers’ Protest Affects Every Discipline. Yes, Even Software.]]></title>
            <link>https://dilrajio.medium.com/standing-with-farmers-introducing-five-river-code-d7c4acb87b5d?source=rss-137034955741------2</link>
            <guid isPermaLink="false">https://medium.com/p/d7c4acb87b5d</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[punjab]]></category>
            <category><![CDATA[christopher-alexander]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[dilrajio]]></dc:creator>
            <pubDate>Tue, 09 Mar 2021 14:06:08 GMT</pubDate>
            <atom:updated>2021-03-12T22:36:40.796Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EXWAGTfKTGkHSX4IX8BYxQ.png" /><figcaption>Punjabi farmer on his 100th day of the protest.</figcaption></figure><p>Towards the end of last year, from the wake of the pandemic that shook the global communities, farmers across various states in India unified in the millions to lead a roaring protest against the Bills passed by the Indian Government to “disrupt” the agricultural sector.</p><p>From the perspective of (millions of) farmers, India’s new law will result in the financial devastation of local farmers while fuelling corporations.</p><h4><strong>The Farmer’s Defeat is Our Defeat</strong></h4><p>Whether or not you come from a farming background, or have roots from the rebelling states… as engineers, creators and/or artists, the farmer’s defeat is our defeat because it insinuates a cultural shift that ultimately marginalizes the voice, the craft and the leadership of the craftsmen.</p><p>Merely passing this issue off as a “farmer problem” is a great overlook that should not be underestimated<strong>. </strong>Below, I will exemplify the extent to which various disciplines, including YOURS, are subject to similar but different kinds of exploitation.</p><h4>The Need For Rationality</h4><p>When a designer/engineer cannot precisely understand a problem, they do something much worse than just conforming to some <em>arbitrarily chosen formal order. N</em>ot only does the problem remain unsolved, but they’ve also created an invitation for their “successors<em>” </em>— <em>for lack of a better word </em>— to follow their incompetence.</p><blockquote><strong>Rising Engineer</strong>: “Arggh! I can’t figure out _____.”</blockquote><blockquote>“Elite” Engineer: “Just use ________.”</blockquote><p>That is unless the leader confesses their inability to comprehend the problem. Else, it must be up to the other team member(s) to recognize that a problem persists and then intuitively convince the majority to seek better solutions. Without any action, this attitude will grow, expand and normalize within the discipline.</p><p>* <strong>Note</strong>: This is irrelevant to the hierarchy of a given team.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UQ4mHV7nXiXT03aX" /><figcaption>Sorry Seattle, I had to do it to ya — <strong>via Twitter @CheapoCrappy</strong></figcaption></figure><p>Urban and residential designs didn’t become… “<em>Wal-Martified</em>” overnight. Highway 401 didn’t expand to double-digit lanes in just 10 years, just like how the `node_modules` wasn’t always 800+ directories. Even with gradual progression, we’ve created an ecosystem that is unsustainable and unbeautiful.</p><p>Precisely when and <em>how</em> this began is beyond this scope. Could it have something to do with the industrial revolution and the mass production of everything? Could it have something to do with pushing for faster development to fulfill the superfluous promises of upper management capped by unrealistic deadlines? Could it be a result of the fact that “<em>we live in a capitalistic society… </em>etc?” The answers rely somewhere more upon fundamental. The outcome of a beautiful, sustainable and “more human” experience is immediately at risk when the craftsman’s<strong> </strong>rationale is threatened.</p><blockquote>“Can we at all hope to create a world in which things are made with judgment, with love, with adaptation? With continuous modification… with everything that transpires in the system that I have come to call ‘System A?’ ‘System B’ is the production world of the B-17s and of the computers, prefabricated houses, supermarkets, factories, and forth. All of which, of course, we benefit from on some material level, but it does take away from our birthright and heritage. And makes it almost impossible to be a full human being.”</blockquote><blockquote>—<strong> Christopher Alexander, 2012. Public Lecture @ </strong><a href="https://medium.com/u/255942f15b34"><strong>UC Berkeley</strong></a></blockquote><h4>The Loss of Innocence</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MRy4IMGZCsAgFgof" /><figcaption>“<em>Morris &amp; Co. These photos show unnamed weavers in the tapestry weaving shed at Merton Abbey and the Firm’s tapestry repair workshop at Granville Place, London, in 1931</em>” <strong>— via Twitter @ </strong><a href="https://twitter.com/WMGallery/status/1368917742926114820"><strong>WMGallery</strong></a></figcaption></figure><p>Alexander strategically noted the “loss of innocence” in his groundbreaking work, <em>Notes on the Synthesis of Form,</em> alluding to the 19th-century designer, William Morris; an early pioneer who saw the misuse of machines. Instead of conforming to this rising revolution, he had initiated Morris &amp; Co. The firm specialized in various hand-made crafts to prove its superiority and the increased quality of life that the building process introduced. Though Morris’ work was an influence to many, “It was not until Gropius started his Bauhaus that designers came to terms with the machine and the loss of innocence which it entailed” (Alexander, 9).</p><h4>Back to The Kisaans</h4><p><em>Kisaan</em> = Farmer</p><p>The Indian government passed three bills that collectively “invite big players into a fragmented and deregulated market that could lead to volatile prices for farmers” — <a href="https://www.vox.com/videos/22205334/indias-huge-farmer-protests-explained">Vox</a>.</p><p>For over 100 days, farmers across Punjab, Haryana, Uttara Khand, Uttar Pradesh (and many more) have given not only their time, in some cases, their freedom and their lives to fight these newly admitted rules.</p><p>Below is a (very) brief overview of events thus far:</p><ul><li>Over 20,000 farmers in India have committed suicide in the past 2 years</li><li>Protesters have been subject to police brutality</li><li>Around 150 protesters have lost their lives throughout the protests</li><li>Journalists have been illegally detained, assaulted for raising their voices</li><li>Propaganda and harmful misinformation have polluted websites like Twitter, Reddit in a (hilariously poor) attempt to discredit the <em>kisaans</em>.</li></ul><p>A protest this large begs the question,… is this just about protecting a pivotal group from the mercy of greedy corporations? Is it just about “making sure” that the farmers who make our bread and butter are compensated fairly? Or is there something truly more fundamental that genuinely affects us all…? Concerning the way we build, deliver and live?</p><h4>Learn More About the Farmers Protest</h4><ul><li><a href="https://www.youtube.com/watch?v=iHpZV7ro7lU">India’s huge farmer protests, explained — Vox [Video]</a></li><li><a href="https://www.kisaanekta.co/documenters">https://www.kisaanekta.co/documenters</a> [Collection of Journalists]</li><li><a href="https://www.protectfarmers.org/">https://www.protectfarmers.org/</a></li></ul><h4>Inspiration for ‘Five River Code’</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0QLgnbf6oOTS3InMhV9rLg.png" /><figcaption><a href="https://www.youtube.com/channel/UCbvJH6l-xcpBYmyQnxAYmMQ/about">Five River Code </a>— We are creating accessible software engineering content among the Punjabi community.</figcaption></figure><p>To facilitate this shared grief of the <em>kisaans</em>, I had channelled it — no pun intended — to start creating software educational videos in the mother tongue, <strong>Punjabi</strong>. At the time, I was focused on making moves to Seattle’s tech scene, thus, the content naturally gravitated towards Data Structures &amp; Algorithms. But, this is just the beginning! I have been lucky enough to collaborate with people from Punjab to expand the content!</p><p>If you want to keep up to date with any videos, Subscribe to <a href="https://www.youtube.com/channel/UCbvJH6l-xcpBYmyQnxAYmMQ">Five River Code</a>! For any non-video content in the future make sure you follow on Medium as well!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d7c4acb87b5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sharpening the Junior Developer — Is This Handbook Worth Your Time?]]></title>
            <link>https://blog.devgenius.io/sharpening-the-junior-developer-is-this-handbook-worth-your-time-13d74c244ee0?source=rss-137034955741------2</link>
            <guid isPermaLink="false">https://medium.com/p/13d74c244ee0</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[junior-developer]]></category>
            <dc:creator><![CDATA[dilrajio]]></dc:creator>
            <pubDate>Thu, 02 Jul 2020 03:06:30 GMT</pubDate>
            <atom:updated>2020-07-11T08:44:30.415Z</atom:updated>
            <content:encoded><![CDATA[<h3>Sharpening the Junior Developer — Is This Handbook Worth Your Time?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AG4Dapdpv7vpeybxUF35KA.png" /><figcaption>Photoshopping in <a href="https://app.diagrams.net/">draw.io</a> is harder than it sounds.</figcaption></figure><p><a href="https://www.learninpublic.org/">The Coding Career</a> book serves one objective and that is <strong>securing software jobs and excelling at them. </strong>You have already seen a repeated number of blogs on career advice, negotiating or the typical “<em>Top 5 x To Become Better At y”. </em>This isn’t a career advice book. It is packed with sources, citations, quotes and consistently introduces you to things that would otherwise take years to learn.</p><blockquote>“This book will help you work smart. How hard you’re able to work is ultimately up to you. As Shawn is quick to point out, <strong>this is a marathon, not a sprint</strong>. So pace yourself.”</blockquote><blockquote>— <a href="https://medium.com/u/17756313f41a">Quincy Larson</a> (Founder of <a href="https://medium.com/u/8b318225c16a">freeCodeCamp</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y3cD2y9Vo-n-iePH5FUC_A.jpeg" /><figcaption>i was blind but now i see —<a href="https://www.youtube.com/watch?v=BtT2vmDYwOg"> Limitless 2011</a></figcaption></figure><p>Below are one of the many things I highlighted while reading the book. At the very least, I highly recommend you take a peek at the <a href="https://www.learninpublic.org/toc">ToC</a>!</p><h4>Learning in Public</h4><p>We’ve spent a majority of our lives learning and training in private. Whether it is in school, SATs, the gym or college… this pattern eventually transitions into the workplace as well.</p><p>There are many skilled engineers who unfortunately spend their career encapsulating all their know-how in their head.<strong> </strong>When you “learn in public,” you tremendously increase the speed you learn, grow your network while ultimately… building a (soon to be) kickass career.</p><p>How do you do it? One form may involve writing blogs or live-stream programming, answering Stackoverflow questions, it doesn’t matter. What matters is that you are <strong>crafting meaningful content publicly</strong>. Content that you <em>wish </em>you had found.</p><p>The chapter goes into a lot more depth, but the key take away is when you learn in public you have the advantage of:</p><ul><li>Attracting online tech communities</li><li>Receiving mentorship from collaborators, seniors, etc.</li><li>Learn FASTER</li></ul><p>“Learn FASTER” might sound obtuse, but think of it this way; who do you think is going to have a nicer physique by the end of the year? Overweight person <strong>A</strong>, working out in the basement 3–5 days a week… <strong>or</strong> overweight person <strong>B</strong>, working out at the local gym 3–5 days a week <strong>and</strong> joining the monthly gym challenge once a month?</p><h4>Know Your Tools</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ugFQHwRLj6MPZYK1H_vzWg.png" /><figcaption>We’ve all been there, <a href="https://medium.com/u/ab26c40a3a46">Laurie,</a> don’t worry.</figcaption></figure><p>The difference between knowing your tool and knowing it <em>well</em>, is huge!</p><p>Proficiency in tools like GIT, bash (or whatever it is that you use) and the knowing <em>underneath the hood </em>can be a paradigm shift for developers. I can’t think of how many times I’ve seen the following code:</p><pre>app.get(&#39;/&#39;, (req, res) =&gt; {<br>  // ...<br>});</pre><p>I didn’t question where the heck req and res was coming from… as a result, I essentially handicapped myself from exploring and debugging Node’s I/O.</p><p>With shiny new objects appearing on the block everyday, it takes skill to know when to pick up a tool and <strong>when to not; </strong>Shawn makes this crystal clear in further chapters!</p><p>A lot can be gained investing in the tools you, your employer already utilize.</p><h4>Senior Engineer &amp; Business Impact</h4><p>As your career begins to season, it becomes visible that there are bigger things than just <em>code. </em>Throughout the book, it becomes evident that there are various impactful traits that go beyond the 15&quot; screen. One of these qualities is the Senior Engineer’s <em>sense</em> of the<em> </em><strong><em>bigger picture.</em></strong></p><p>In other words<em>, </em>how the code and systems can drive the company earning$! Shawn puts it beautifully in this chapter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CaBYaWv2yCXDSs-gA7BfRw.png" /><figcaption><strong>NOTE: </strong>The page on the left is not the actual design of the book</figcaption></figure><p>As I mentioned before, one of the biggest benefits of the book is the primary and secondary sources, stories — Tweets even — to provide curation and context.</p><h4>Good Enough &gt; Best</h4><p>Good enough is… <em>good enough</em>. Let me be clear; this does <strong>NOT</strong> mean delivering slightly shittier code just because it’s <em>good enough</em>.</p><p>Understand that obsessing over minuscule benchmarks and craving the latest and greatest is <strong>extremely inefficient. </strong>Do you want some random party to try tell you who and what the “<em>best</em><strong><em>”</em></strong> really is? Hell no, instead, “<strong><em>you reclaim your own agency.</em></strong>”</p><p>The biggest side effect of being a “best-seeker” is that in entails <strong>false confidence</strong>. Joining the <em>bandwagon </em>because of precise metrics does not automatically equate to better results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v9fnX-iLFSi92-Np3kzKrw.png" /><figcaption>4th quadrant demonstrates how false precision is mislead just as it is harmful</figcaption></figure><blockquote>“Seek to be approximately correct vs being precisely wrong.</blockquote><h4>Review</h4><p>No one is ever going to be as invested in your career as you are. This industry can always benefit from more thoughtful and strategic engineers. The Coding Career is designed to last through your adolescent years in the industry.</p><p>A big thanks to <a href="https://medium.com/u/547f259e265e">Swyx</a> (Shawn) for compiling one of the <strong>few — </strong>for a lack of better of words — <em>junior to senior </em>books! Also, a shout out to the <a href="https://www.reactiflux.com/">Reactiflux community</a> for consistently supporting and inviting kickass engineers!</p><p><a href="https://swyx.podia.com/coding-career-handbook/s3m0e"><strong>Buy the book here!</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=13d74c244ee0" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/sharpening-the-junior-developer-is-this-handbook-worth-your-time-13d74c244ee0">Sharpening the Junior Developer — Is This Handbook Worth Your Time?</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chapter 4 — Functions]]></title>
            <link>https://blog.devgenius.io/chapter-4-functions-d5395fd83786?source=rss-137034955741------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5395fd83786</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <category><![CDATA[clean-code]]></category>
            <dc:creator><![CDATA[dilrajio]]></dc:creator>
            <pubDate>Mon, 11 May 2020 02:07:19 GMT</pubDate>
            <atom:updated>2021-05-05T07:38:07.527Z</atom:updated>
            <content:encoded><![CDATA[<h3>Chapter 3— Functions</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PJzeX047sv86oaiKQk_Iog.png" /><figcaption>Chez Vince —<strong> Disney’s Recess</strong></figcaption></figure><p>Before you were probably born, <a href="https://www.youtube.com/watch?v=Og847HVwRSI">Fortan dominated the charts in popularity for nearly 3 decades.</a> You can imagine how much different the dynamics of Software has changed since then, but <strong>functions</strong> <strong>still prevail.</strong></p><p>Today we are going to dive into cooking up nice, clean functions!</p><h4>Small — The 1st Rule</h4><p>You may have been given advice to keep your functions no bigger than a screen scroll.</p><h4>Even Smaller — The 2nd Rule</h4><p>While I cannot give you an exact number, 20 lines is more than enough. Enough — that it should hardly ever be 20 lines.</p><h4>Blocks &amp; Indentation</h4><p>Blocks within indents should generally be ONE line. If you ever find yourself writing huge chunks of instructions between if statements or for loops, there is a good chance you can put that into a function of it’s own .</p><p>To illustrate, look at how many principles we are breaking. There is too much repetition, there is so many unnecessary comments since it is so confusing to read (<em>hint, hint… the next chapter) </em>and there is so much happening with blocks of indentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d66W1ODrY9toQCFZe7u-Kw.png" /><figcaption><strong>NOT GOOD.</strong></figcaption></figure><h4>Should Do One Thing. Should Do It Well. Should Do it ONLY.</h4><p>Sounds simple, but what is <em>one thing?</em></p><p>Suppose you want to submit an updated username by submitting the form the API. Roughly speaking, you will have to:</p><ol><li>Validate input is a String</li><li>Get authenticated user token</li><li>Fire XHR request with the input string data</li></ol><p>Is this doing one <em>thing…</em> or three? It will take some time and experience to decipher, but a general rule of thumb is this; we create functions to decompose larger instructions of code. <strong>However, </strong><em>if you can extract another function, </em>from within the function… there is a good chance you should write another function.</p><p>For example, if instead you were validating the input is a string <strong>and </strong>has <em>x</em> number of characters <strong>and </strong>validating special characters, you should create validateUsernameInput(username) function and call that.</p><h4>Switch Statements</h4><p>They are risky business when it comes to dealing with functions. If you’re like me, you know how kickass <a href="https://blog.logrocket.com/use-hooks-and-context-not-react-and-redux/">React Hooks/Context/Redux</a> can be with switch statements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*sIyoZ3rq_mJ4GLQO.png" /><figcaption>Abstract Factory — Comic courtesy of <a href="https://refactoring.guru/design-patterns/abstract-factory">refactoring.guru</a></figcaption></figure><p>Here’s the problem (according to Uncle Bob)… they violate Single Responsibility Principle (SRP). How the hell is there any sense of responsibility for a <strong><em>function that has unlimited reasons to change</em>? </strong>In OOP, you can use switches in abstract factories to return polymorphic objects, but that does sound quite frightening —doesn’t it?</p><p>I will be back when I find a safe and appropriate way to invoke functions within switch statements.</p><h4>Use Descriptive Names</h4><p>This is important so I will get straight to the point:</p><ul><li>Make them <strong>descriptive</strong></li><li>Don’t lie</li><li>Take your time</li></ul><p>These points can be extrapolated into a self-help book, but they apply to function names too. Hunting for a good name will take renames and refactors but it is worth it because it cementifies the direction and design of your software.</p><p>Easier said than done. Seriously.</p><h4>Consistency</h4><p>getStage(), fetchStage(), currentStage()! WELL… which one is the best name?! Is getStage a class method… or will it perform an HTTP Get request… or will it start computing integers? Having these patterns early on can be quite rewarding in the long run as you won’t have to second guess every time.</p><h3>Arguments</h3><p>Functions can take arguments and they can be very powerful!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*naE_rNFo0Los5panq8HaCQ.png" /><figcaption>Function signature + adjectives!</figcaption></figure><h4>Dyadic Functions</h4><p>It will always be easier to read:</p><pre>// monadic<br>def add_hours(num_hours)</pre><p>Then:</p><pre>// dyadic<br>def add_hours(unix_time, num_hours)</pre><p>The dyadic function is still pretty readable and understandable. Sure, the first one is nice and buttery; the dyadic function just takes a second longer. The problem is, <strong>one of the arguments </strong>tend to get <em>overlooked. </em>Eventually,<em> </em>developers are going to learn to intentionally skip that argument and just look at num_hours .</p><blockquote>“The parts we ignore are where the bugs will hide.” — Martin (4.42)</blockquote><p>When you do run into the scenario where you need to use a dyadic function, you, the arguments should appear natural; <em>natural cohesion </em>and <em>natural ordering</em>. For example, makeCircle(coordinate, radius) there is a <em>naturalness </em>to coordinate and radius, compared to a function like buyGasoline(octane, carTankSize) .</p><h4>Triadic &amp; Polyadic Functions</h4><p>At this point, it may make sense to wrap it a separate Class. In MVC, you may want to create a new model to alleviate the widespread arguments.</p><p>If possible, using Objects in arguments can reduce the argument numbers as well:</p><p>Suppose we parse out some important information and now with this important info, we want to fire it somewhere!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%28255%252C255%252C255%252C0%29%26t%3Dbase16-light%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D3px%26dsblur%3D7px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D21px%26ph%3D25px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%25252F%25252F%252520Polyadic%25250Afunction%252520createDiagnosticUnit%252520%25253D%252520async%28chassisSerial%25252C%252520deviceId%25252C%252520pcbSerial%25252C%252520tester%29%252520%25257B%25250A%252520%252520const%252520diagnosticUnit%252520%25253D%252520await%252520apiPost%28%2527%25252Fdiagnostic-unit%2527%25252C%252520%25257B%25250A%252520%252520%252520%252520chassisSerial%25252C%25250A%252520%252520%252520%252520deviceId%25252C%25250A%252520%252520%252520%252520pcbSerial%25252C%25250A%252520%252520%252520%252520tester%25252C%25250A%252520%252520%25257D%29%25253B%25250A%252520%252520%25250A%252520%252520return%252520diagnosticUnit%25253B%25250A%25257D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%28255%25252C255%25252C255%25252C0%29%26t%3Dbase16-light%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D3px%26dsblur%3D7px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D21px%26ph%3D25px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D%2525252F%2525252F%25252520Polyadic%2525250Afunction%25252520createDiagnosticUnit%25252520%2525253D%25252520async%28chassisSerial%2525252C%25252520deviceId%2525252C%25252520pcbSerial%2525252C%25252520tester%29%25252520%2525257B%2525250A%25252520%25252520const%25252520diagnosticUnit%25252520%2525253D%25252520await%25252520apiPost%28%27%2525252Fdiagnostic-unit%27%2525252C%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520chassisSerial%2525252C%2525250A%25252520%25252520%25252520%25252520deviceId%2525252C%2525250A%25252520%25252520%25252520%25252520pcbSerial%2525252C%2525250A%25252520%25252520%25252520%25252520tester%2525252C%2525250A%25252520%25252520%2525257D%29%2525253B%2525250A%25252520%25252520%2525250A%25252520%25252520return%25252520diagnosticUnit%2525253B%2525250A%2525257D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/17d34ee1b857c341b104358df6e376d6/href">https://medium.com/media/17d34ee1b857c341b104358df6e376d6/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%28248%252C231%252C28%252C0%29%26t%3Dyeti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D0px%26dsblur%3D6px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D21px%26ph%3D27px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D....................................................................................%25250Alet%252520unitParams%252520%25253D%252520%25257B%252520chassisSerial%25252C%252520deviceId%25252C%252520pcbSerial%252520%25257D%25250A%25250A%25252F%25252F%252520Or%252520using%252520OOP%25250Afunction%252520UnitParams%28chassisSerial%25252C%252520deviceId%25252C%252520pcbSerial%29%252520%25257B%25250A%252520%252520this.chassisSerial%252520%25253D%252520chassisSerial%25253B%25250A%252520%252520this.deviceId%252520%25253D%252520deviceId%25253B%25250A%252520%252520this.pcbSerial%252520%25253D%252520pcbSerial%25253B%25250A%252520%252520%25250A%252520%252520return%252520this%25253B%25250A%25257D%25250A%25250AunitParams%252520%25253D%252520new%252520UnitParams%28chassisSerial%25252C%252520deviceId%25252C%252520pcbSerial%29%25253B%25250A%25250A%25252F%25252F%252520Now%252520you%252520can%252520do%25253A%25250Afunction%252520createDiagnosticUnit%252520%25253D%252520async%28unitParams%25252C%252520tester%29%252520%25257B%25250A%252520%252520return%252520await%252520apiPost%28%2527%25252Fdiagnostic-unit%2527%25252C%252520%25257B%252520unitParams%25252C%252520tester%252520%25257D%29%25253B%25250A%25257D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%28248%25252C231%25252C28%25252C0%29%26t%3Dyeti%26wt%3Dnone%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D0px%26dsblur%3D6px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D21px%26ph%3D27px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3D....................................................................................%2525250Alet%25252520unitParams%25252520%2525253D%25252520%2525257B%25252520chassisSerial%2525252C%25252520deviceId%2525252C%25252520pcbSerial%25252520%2525257D%2525250A%2525250A%2525252F%2525252F%25252520Or%25252520using%25252520OOP%2525250Afunction%25252520UnitParams%28chassisSerial%2525252C%25252520deviceId%2525252C%25252520pcbSerial%29%25252520%2525257B%2525250A%25252520%25252520this.chassisSerial%25252520%2525253D%25252520chassisSerial%2525253B%2525250A%25252520%25252520this.deviceId%25252520%2525253D%25252520deviceId%2525253B%2525250A%25252520%25252520this.pcbSerial%25252520%2525253D%25252520pcbSerial%2525253B%2525250A%25252520%25252520%2525250A%25252520%25252520return%25252520this%2525253B%2525250A%2525257D%2525250A%2525250AunitParams%25252520%2525253D%25252520new%25252520UnitParams%28chassisSerial%2525252C%25252520deviceId%2525252C%25252520pcbSerial%29%2525253B%2525250A%2525250A%2525252F%2525252F%25252520Now%25252520you%25252520can%25252520do%2525253A%2525250Afunction%25252520createDiagnosticUnit%25252520%2525253D%25252520async%28unitParams%2525252C%25252520tester%29%25252520%2525257B%2525250A%25252520%25252520return%25252520await%25252520apiPost%28%27%2525252Fdiagnostic-unit%27%2525252C%25252520%2525257B%25252520unitParams%2525252C%25252520tester%25252520%2525257D%29%2525253B%2525250A%2525257D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/24ec95d5737c6af5611646d2bdcddd75/href">https://medium.com/media/24ec95d5737c6af5611646d2bdcddd75/href</a></iframe><h4>You Don’t Need Flag Arguments</h4><p>Boolean arguments in function signatures is a sign that the function is doing more than one thing.</p><p>Really, you should divide it into 2 separate functions.</p><h4>No Side Effect! No Lies!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BDn2TAw48G0H1_lE6uEing.png" /><figcaption>Can you spot the Side Effect?</figcaption></figure><p>This function <strong><em>should </em></strong>just validate whether the password is right. But because of the side effect (line 8) any time someone wants to validate their input password, they’ve unnecessarily created a Authorization Token.</p><p>It’s doing more than one thing. It’s lying. Thus, functions with side-effects are not clean.</p><p>You can obviously read these in greater detail in the <strong>Chapter 4</strong> of Clean Code, but here are some important concepts developers should keep in mind:</p><p><strong>One Level of Abstraction per Function</strong>: Basically, don’t mix complex and low level abstractions. Something like adding a .toString(2) after a complex calculation.</p><p><strong>The Stepdown Rule</strong>: Your code should read from top to bottom like a narrative, or as if you are “walking through” the code layer by layer of abstraction.</p><p><strong>Prefer Exceptions or Returning Error Codes</strong>: When returning custom error codes, you may end up in an if else hell. Martin argues it is preferable to straight up try, catch the (err) and return that.</p><p>Since we are talking about error handling, I would also argue that (almost) all responses should be handled in a separate function. Your function is one <strong>thing</strong>, dealing with successful response and errors is another<strong> thing</strong>.</p><p><strong>Tip from last chapter</strong>: Maybe you’ve seen getProductInfo() when it could’ve easily have been getProduct(). General rule of thumb, words like data or info are disinformation, they don’t cause any confusion, but <strong>they don’t add any value either.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5395fd83786" width="1" height="1" alt=""><hr><p><a href="https://blog.devgenius.io/chapter-4-functions-d5395fd83786">Chapter 4 — Functions</a> was originally published in <a href="https://blog.devgenius.io/">Dev Genius</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chapter 2 — Meaningful Names]]></title>
            <link>https://dilrajio.medium.com/chapter-2-meaningful-names-adcbaa5fcbcb?source=rss-137034955741------2</link>
            <guid isPermaLink="false">https://medium.com/p/adcbaa5fcbcb</guid>
            <category><![CDATA[coding-style]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software]]></category>
            <dc:creator><![CDATA[dilrajio]]></dc:creator>
            <pubDate>Tue, 17 Mar 2020 13:31:02 GMT</pubDate>
            <atom:updated>2020-03-21T19:42:47.524Z</atom:updated>
            <content:encoded><![CDATA[<h3>Chapter 2 — Meaningful Names</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*o1feH78-mJHhPxQuN7EG8Q.png" /><figcaption><a href="https://simpsons.fandom.com/wiki/A_Tale_of_Two_Springfields/References">Lenny = White, Carl = Black</a></figcaption></figure><blockquote>If your shitty code still has good variable and function names, then it’s not entirely shit. — Unknown</blockquote><p>You already know the importance of crafting meaningful names. The type of name that you see and does exactly what you expect. It puts a smile on your face because it behaves precisely as it should; there is <em>nothing</em> you can do… to make this any more definitive.</p><p>While I am not going to talk about <em>why </em>you should write good names, below is some detailed discourse on strategically crafting names with examples where necessary. <strong>Note</strong>, these concepts are speaking in the <strong>framework of</strong> <strong>software,</strong> <strong>not a specific language, paradigm or library. </strong>Once we can understand the philosophy behind a well crafted variable, then transferring the knowledge across different bodies within software will be easier.</p><h3>Use Intention Revealing Name</h3><p>Instead of:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HBlAeYZiWVlqyZlCyrWJqQ.png" /></figure><p>You might look at this and ask the same questions:</p><ul><li>What is <strong>data</strong>? What does it represent? Is it a CSV?</li><li>What does <strong>i</strong> even represent? Why is <strong>i[4] </strong>so damn important?</li><li>What the heck is the <strong>list</strong> ? What is it a list of?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PQccqjfRlejdtasYvzNoEQ.png" /></figure><h3>Avoid Disinformation</h3><h4>Avoid Reserved Words</h4><p>To begin, almost every language has a set of reserved words. Though I can’t list them all right here, but words like <strong>class</strong>, <strong>package</strong>, <strong>super</strong>, <strong>public</strong>, <strong>private</strong> even <strong>if</strong> and <strong>else</strong>.</p><p>Obviously, nobody is crazy enough to write int else = 100;, but this even applies to words like <strong>char</strong>, <strong>cpu</strong>, <strong>hp</strong> or <strong>kernel</strong>. Even if they are unreserved (in the context) and they make sense, the problem is that <strong>they globally imply something else to many other engineers.</strong></p><h4>Avoid False Accusations</h4><p>Stop blatantly lying in your code.</p><p>Do not call it a chapterNamesArray if it is not an array. Do not call it a chapterNamesArray if it contains names and page_numbers .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UYSdazJuL67ZrvQOFvfjuA.png" /><figcaption><strong>DO NOT LIE YOURSELF IN YOUR CODE —</strong> <a href="https://carbon.now.sh/">Carbon.now</a></figcaption></figure><p>This is usually a result of the developer changing their original intentions of the data they want to communicate with. Since it is easier to “stuff” things into an already implemented array<strong>, us developers, sometimes overlook the need to rename what we redefine.</strong></p><h4>Avoid Frightfully Similar Names</h4><p>It might seem valid in the beginning to have methods named:</p><ul><li>getCurrentLevel</li><li>getCurrentLevelName</li><li>getCurrentLevelActiveBoards and</li><li>getCurrentLevelActiveBoardWithName(boardName)</li></ul><p>But as your codebase grows, not only will the names begin to get a bit blurry, but could you imagine the mess you would have to do deal anytime you type “<em>getC</em>” in your Text Editor/IDE.</p><p><em>Note: The upcoming chapters will discuss in more detail on the preferred technique of dealing with these situations.</em></p><p>This brings us the next point.</p><h4>Use Searchable</h4><p>Outside of a loop, we should never use single character variable names. Using the <strong>Find in All Files </strong>is one of the sharpest tools we have in the shed, but using shitty, unsearchable names is counter intuitive.</p><p>Searching for variable defined as var num is <strong>always</strong> going to be much harder than if it were named var num_students.</p><h4>Use Pronounceable Names</h4><h4>Inconsistent Spelling</h4><p>It’s a cheap shot, but using different names or one-offs is another example of disinformation. You’ll see this in CSS a lot:</p><pre>.flex<br>  display: flex;<br>  justify-content: center;<br>  align-items: center;<br>}</pre><p>and…</p><pre>.flex-center {<br>  display: flex;<br>  justify-content: center;<br>  align-items: center;<br>}</pre><p>Odds are you will have some</p><h4>Avoid Member Prefixing</h4><p>It used to be a practice for developers to to prefix instance variables with m_ to signify that m_user in a function, is different from userin a Class.</p><p>The reality is:</p><ol><li>Our Class and functions should already be small enough to easily distinguish the difference (especially if your theme highlights it differently)</li><li>The prefix gets ignored anyways</li></ol><h4>Class / Component Names</h4><p>They should be nouns!</p><p>User, NotificationScreen, Poem are suitable for a class name. But you wouldn’t want to call it, CreatingUser, because this name implies a set of instructions, instead of a <strong>general thing.</strong></p><p>On the other hand, you don’t want to OVER generalize. If you are using words like: Parser, or Data or Information, it doesn’t add any value, when it could be named something like PoemAnalytics</p><h4>Method Names</h4><p>They should have verbs! Usually nouns, too!</p><p>save()is an example of a method that only contains a verb. Though, you could write saveObject() or saveRecord(), however, save() is a pretty standard and traditional method.</p><p>Otherwise, they could be grouped in a verb + noun format. For example: getToken() or parseEvent() .</p><h4>Don’t Be Cute.</h4><p>Using company or team jargon is great… outside the codebase. A function called greatDepression() might seem funny when you are trying to kill all the enqueued jobs.</p><h4>* Pick One Word per Concept [<em>Consistent Lexicon</em>]</h4><p>Have you ever written a an AJAX function to <strong>fetch</strong> some data? Or <strong>get </strong>some data? Or <strong>retrieve </strong>data? Or an XHR to pull<strong> some data?</strong></p><p>The sentences above do the same thing… but they don’t have to named with a different verb for the same concept every time.</p><p>Imagine if you want to import a setter from a module, how are you going to guess correctly between updateHighlightedLink() or setHighlightedLink() or modifyHighlightedLink() if you use update, set and modify interchangeably within the same concept.</p><p>This isn’t <em>just</em> about saving time and ease understanding.<strong> The different words leads developers to expect a different result because of them.</strong></p><h4>Don’t Pun.</h4><p>This closely relates to the previous point.</p><p>The team might conclude that they will prefix add to any method that is going be <em>adding </em>single items to a data collection. Sounds good, <strong>right? </strong>What could go wrong?</p><p>The reality is, Array, Queue, Stack have their own vocabulary for “<em>adding” </em>to them. Thus, unless you use push or enqueue respectively, then the add method would be pun.</p><blockquote><em>“In general, programmers are pretty smart people. Smart people sometimes like to show off their smarts by demonstrating their mental juggling abilities[…] One difference between a smart programmer and a professional programmer is that the professional understands that clarity is king</em>” —( M2.25).</blockquote><h4>Contextualization — Meaningful Context</h4><p><em>There are few names which are meaningful in and of themselves — most are not </em>(M2.27).</p><p>To account for this, the value is added by what the information is surrounded by, such as well named functions, Classes, modules, etc.</p><p>From my personal experience and the example I have seen, this takes a combination of skills. Rethinking the variable scope is necessary, there is smaller, but more function methods.</p><p>Take this for example:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcarbon.now.sh%2Fembed%3Fbg%3Drgba%28171%252C184%252C195%252C0%29%26t%3Dhopscotch%26wt%3Dbw%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D8px%26dsblur%3D29px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D21px%26ph%3D45px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%2525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%252520GenerateNordschleifeEstimateCarReport%28%25250A%252520%252520cylinders%25252C%25250A%252520%252520quarterMileTime%25252C%25250A%252520%252520weight%25250A%29%252520%25257B%25250A%252520%252520let%252520lapTimeEstimations%252520%25253D%252520%25255B%25255D%25253B%25250A%252520%252520let%252520power%252520%25253D%252520weight%252520%25252F%252520%28quarterMileTime%252520%25252F%2525205.825%29%252520%2A%2A%2525203%25253B%25250A%252520%252520let%252520lapTimeVariable%25253B%25250A%25250A%252520%252520%252520%252520if%252520%28cylinders%252520%25253C%25253D%2525206%29%252520%25257B%25250A%252520%252520%252520%252520lapTimeVariable%252520%25253D%2525201.6%25253B%25250A%252520%252520%25257D%252520else%252520if%252520%28cylinders%252520%25253C%25253D%2525208%29%252520%25257B%25250A%252520%252520%252520%252520lapTimeVariable%252520%25253D%2525201.42%25253B%25250A%252520%252520%25257D%252520else%252520%25257B%25250A%252520%252520%252520%252520lapTimeVariable%252520%25253D%2525201.32%25253B%25250A%252520%252520%25257D%25250A%25250A%252520%252520function%252520generateLapTimeSpeed%28%29%252520%25257B%25250A%252520%252520%252520%252520for%252520%28let%252520i%252520%25253D%2525200%25253B%252520i%252520%25253C%2525203%25253B%252520i%25252B%25252B%29%252520%25257B%25250A%252520%252520%252520%252520%252520%252520let%252520splitTime%252520%25253D%252520%28power%252520%25252F%252520500%29%252520%2A%25252010%25253B%25250A%252520%252520%252520%252520%252520%252520%25252F%25252F%252520Lap%252520times%252520should%252520increase%252520each%252520lap%25250A%252520%252520%252520%252520%252520%252520let%252520additionalLapTime%252520%25253D%252520Math.floor%28Math.random%28%29%252520%2A%25252010%252520%2A%252520i%29%25253B%25250A%252509%252520%252520%25252F%25252F%252520Base%252520lap%252520time%252520is%2525205%252520Minutes%25250A%252520%252520%252520%252520%252520%252520let%252520lapTime%252520%25253D%252520%28300%252520%25252B%252520splitTime%29%252520%2A%252520lapTimeVariable%252520%25252B%252520additionalLapTime%25253B%25250A%252520%252520%252520%252520%252520%252520lapTime%252520%25253D%252520new%252520Date%28lapTime%252520%2A%2525201000%29.toISOString%28%29.substr%2811%25252C%2525208%29%25253B%25250A%252520%252520%252520%252520%252520%252520lapTimeEstimations.push%28lapTime%29%25253B%25250A%252520%252520%252520%252520%25257D%25250A%252520%252520%252520%252520return%252520lapTimeEstimations%25253B%25250A%252520%252520%25257D%25250A%25250A%252520%252520return%252520%25257B%252520power%25252C%252520estimated_lap_time%25253A%252520generateLapTimeSpeed%28%29%252520%25257D%25253B%25250A%25257D&amp;display_name=Carbon&amp;url=https%3A%2F%2Fcarbon.now.sh%2F%3Fbg%3Drgba%28171%25252C184%25252C195%25252C0%29%26t%3Dhopscotch%26wt%3Dbw%26l%3Djavascript%26ds%3Dtrue%26dsyoff%3D8px%26dsblur%3D29px%26wc%3Dtrue%26wa%3Dtrue%26pv%3D21px%26ph%3D45px%26ln%3Dfalse%26fl%3D1%26fm%3DHack%26fs%3D14px%26lh%3D133%252525%26si%3Dfalse%26es%3D2x%26wm%3Dfalse%26code%3Dfunction%25252520GenerateNordschleifeEstimateCarReport%28%2525250A%25252520%25252520cylinders%2525252C%2525250A%25252520%25252520quarterMileTime%2525252C%2525250A%25252520%25252520weight%2525250A%29%25252520%2525257B%2525250A%25252520%25252520let%25252520lapTimeEstimations%25252520%2525253D%25252520%2525255B%2525255D%2525253B%2525250A%25252520%25252520let%25252520power%25252520%2525253D%25252520weight%25252520%2525252F%25252520%28quarterMileTime%25252520%2525252F%252525205.825%29%25252520%2A%2A%252525203%2525253B%2525250A%25252520%25252520let%25252520lapTimeVariable%2525253B%2525250A%2525250A%25252520%25252520%25252520%25252520if%25252520%28cylinders%25252520%2525253C%2525253D%252525206%29%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520lapTimeVariable%25252520%2525253D%252525201.6%2525253B%2525250A%25252520%25252520%2525257D%25252520else%25252520if%25252520%28cylinders%25252520%2525253C%2525253D%252525208%29%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520lapTimeVariable%25252520%2525253D%252525201.42%2525253B%2525250A%25252520%25252520%2525257D%25252520else%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520lapTimeVariable%25252520%2525253D%252525201.32%2525253B%2525250A%25252520%25252520%2525257D%2525250A%2525250A%25252520%25252520function%25252520generateLapTimeSpeed%28%29%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520for%25252520%28let%25252520i%25252520%2525253D%252525200%2525253B%25252520i%25252520%2525253C%252525203%2525253B%25252520i%2525252B%2525252B%29%25252520%2525257B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520let%25252520splitTime%25252520%2525253D%25252520%28power%25252520%2525252F%25252520500%29%25252520%2A%2525252010%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520%2525252F%2525252F%25252520Lap%25252520times%25252520should%25252520increase%25252520each%25252520lap%2525250A%25252520%25252520%25252520%25252520%25252520%25252520let%25252520additionalLapTime%25252520%2525253D%25252520Math.floor%28Math.random%28%29%25252520%2A%2525252010%25252520%2A%25252520i%29%2525253B%2525250A%25252509%25252520%25252520%2525252F%2525252F%25252520Base%25252520lap%25252520time%25252520is%252525205%25252520Minutes%2525250A%25252520%25252520%25252520%25252520%25252520%25252520let%25252520lapTime%25252520%2525253D%25252520%28300%25252520%2525252B%25252520splitTime%29%25252520%2A%25252520lapTimeVariable%25252520%2525252B%25252520additionalLapTime%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520lapTime%25252520%2525253D%25252520new%25252520Date%28lapTime%25252520%2A%252525201000%29.toISOString%28%29.substr%2811%2525252C%252525208%29%2525253B%2525250A%25252520%25252520%25252520%25252520%25252520%25252520lapTimeEstimations.push%28lapTime%29%2525253B%2525250A%25252520%25252520%25252520%25252520%2525257D%2525250A%25252520%25252520%25252520%25252520return%25252520lapTimeEstimations%2525253B%2525250A%25252520%25252520%2525257D%2525250A%2525250A%25252520%25252520return%25252520%2525257B%25252520power%2525252C%25252520estimated_lap_time%2525253A%25252520generateLapTimeSpeed%28%29%25252520%2525257D%2525253B%2525250A%2525257D&amp;image=https%3A%2F%2Fcarbon.now.sh%2Fstatic%2Fbrand%2Fbanner.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;scroll=auto&amp;schema=carbon" width="1024" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9e5f3c82154be1176216fb7da2aac85/href">https://medium.com/media/c9e5f3c82154be1176216fb7da2aac85/href</a></iframe><p>For one, even though the names are informative and well crafted, there is no context as to when or why a variable should be mutated.</p><p>The generateLapTimeSpeed() function is doing waaaay too much. Join in the next chapter where we focus specifically on functions!</p><p><strong>// Add picture of the good version of the code with good context</strong></p><p>The last thing is also about adding <strong><em>Gratuitous Context</em></strong><em>. </em>It is a good idea to prefixing names when there is not enough context. For example, state might be clear when you are inside of parseAddress() function, but if not, you will need to append userAddrState or just addrState . <strong>However, </strong>the problem arises when done unnecessarily.</p><pre>class PerformanceFuel<br>  Integer pfMaximumOctane<br>  Float pfPricePerLiter<br>  ...</pre><p>In this example, prefixing didn’t add any value, context or make things any easier. It just made it harder for the editor to suggest what the heck you mean when you type pf</p><h4>Closing Remarks</h4><p>Blogging is still something that is new to me. The process of documenting thoughts and notes and publishing them online is an extraordinary amount of effort. This being said, I will continue to fight through the upcoming chapters, however my note-taking and writing style will change in order to get the most out of the blogs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=adcbaa5fcbcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Chapter 1 — Clean Code]]></title>
            <link>https://dilrajio.medium.com/chapter-1-clean-code-f40bc25f38?source=rss-137034955741------2</link>
            <guid isPermaLink="false">https://medium.com/p/f40bc25f38</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <dc:creator><![CDATA[dilrajio]]></dc:creator>
            <pubDate>Tue, 03 Mar 2020 03:28:37 GMT</pubDate>
            <atom:updated>2020-03-03T03:28:37.272Z</atom:updated>
            <content:encoded><![CDATA[<h3>Chapter 1 — Clean Code</h3><h4>There will be code.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pQywzR3CcDKULIabexD9Vg.png" /></figure><p>It is crazy to assume that code will one day become obsolete. <em>Code represents the details of the requirements… </em>details which must be specified explicitly via a machine that can execute them. A skill also known as <em>programming</em>. What people really mean when they say “it should just code automatically it for me” — is that they want an outcome to<em> do what they want; </em>not<em> what they say.</em></p><h3>Bad Code:</h3><p><em>Wad</em>ing (<em>v</em>): Being significantly impeded by bad code.</p><p>If you are like me, you may have been impeded by bad code at some point in your software career. If you are <em>really</em> like me, then it may have even been <strong>your own bad code.</strong></p><p>Why did you write this code?</p><ul><li>Perhaps you were in a rush</li><li>You felt pressured by project managers to get it done sooner than later</li><li>Need to push it fast, but you intended to clean it “<strong>later”</strong></li><li>There were “better” and “more meaningful tasks” in the backlog</li></ul><p>I am sure there was a good reason for why the code was written, but I want to draw out how this habit will overtime <strong>drain productivity.</strong></p><p>To illustrate, imagine that the codebase has been neglected to such a measure… the engineers know it, management knows. So, the only thing left to do is to setup a new team to rebuild the damn codebase in a clean manner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PyTHCDhpQ61bPNOJXkkigg.png" /><figcaption>It may look something like this.. Definitely not something you would want to experience more than once.</figcaption></figure><p>Though I have not seen this personally, software veterans have seen this race last over a <strong>decade</strong>.</p><p>Clean code is not just about time management or productivity. <em>it’s a matter of peofessional survival. — (Martin 1.3)</em></p><h3>Who To Blame?</h3><p>The consequences of owning this total mess <strong>cannot </strong>be shifted to the managers, scrum masters or project owners… We can make numerous compelling arguments about how we were rushed into a delivering a project… but<strong> can we really?</strong></p><p>One thing I am personally bad at doing, is saying “no.” This mental framework is also responsible for polluting a lot of code because the team was continuously accepting and rushing through “<em>quick</em>” projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*Be3RTrLtp4N75RgM63TIiA.png" /></figure><p>As crafters of software, it is our responsibility to defend our software and the contents within it; the same way, a manager will defend their schedule from interruptions and/or unexpected meetings.</p><h3>Words From Some OG’s</h3><p>Uncle Bob was able to ask some of the most prolific and well known developers the golden question:</p><blockquote>What is clean code?</blockquote><p>I highly recommend you read the full epilogues, but here is my personal favourite from Michael Feathers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/1*56MWQyxJWktX9PFWXRqHtQ.png" /><figcaption>Michael Feathers. Author of ‘Working Effectively With Legacy Code’ — Artwork By Jeniffer Kohnke</figcaption></figure><blockquote>“Clean code always looks like it was written by someone who cares.”</blockquote><h3>The Boy Scout Rule</h3><p>Here is one important lesson that you can start applying immediately. If you see some inefficient or <em>hard to read</em> code along the way when programming… just clean it up. A ticket does not need to opened and you’ve also now made the codebase cleaner then it was yesterday.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3UEhwjh6TL_MQmo1wBMTVg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f40bc25f38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Starting to Read ‘Clean Code’]]></title>
            <link>https://dilrajio.medium.com/starting-to-read-clean-code-e32ad8f686d4?source=rss-137034955741------2</link>
            <guid isPermaLink="false">https://medium.com/p/e32ad8f686d4</guid>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[clean-code]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <dc:creator><![CDATA[dilrajio]]></dc:creator>
            <pubDate>Sun, 02 Feb 2020 06:00:22 GMT</pubDate>
            <atom:updated>2020-02-03T15:26:28.131Z</atom:updated>
            <content:encoded><![CDATA[<p>I am beginning to dive into the infamous Clean Code:<em> A Handbook of Agile Software Craftsmanship</em>, written by <strong>Robert C.</strong> <strong>Martin — </strong>or as the internet knows as — &quot;Uncle Bob.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*0SaWuvE-mXItJFut497rzg.jpeg" /><figcaption>An old pal of mine at <a href="https://www.lighthouselabs.ca/toronto">Lighthouse Labs</a>, Toronto, ON.</figcaption></figure><p>Why am I reading this book? Why can’t I just read some blog or use some linter that can do it for me?</p><p>Because it cannot be done for you. There is no tool in the world that can make you write clean code; I believe clean code is a <em>craftsmanship.</em></p><blockquote>Learning to write clean code is hard work. It requires more than just the knowledge of principles and patterns. You must sweat over it. You must practice it yourself, and watch yourself fail. You must watch others practice it and fail…</blockquote><blockquote>~ Clean Code — Introduction (XXVI)</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bde8LsSnF2DawfO6w4OWbQ.jpeg" /><figcaption>“Knowing is not enough, we must apply. Willing is not enough, we must do” — Bruce Lee</figcaption></figure><p>To begin, I have never written a coding blog — or any blog for that matter, so I apologize in advance. <strong>My idea in these blogs will be summarize and highlight the lessons articulated by a <em>master at work. </em></strong>This will include small coding snippets, detailed notes, short stories that I can relate back to you all :)</p><p>Here is just a quick breakdown of how this big is structured:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b5AN-5XaD9kUFNZtGJG9fQ.png" /><figcaption>The book is divided into 3 parts. It is stated clearly that <strong>this is NOT just a feel good coding book.</strong></figcaption></figure><p>Part 1:</p><ul><li>We will learn about the principals and patterns of clean code</li><li>There will be a lot of code in this section and it does take time to comprehend</li></ul><p>Part 2:</p><ul><li>Case studies of complex code + exercises to clean</li><li>Digesting intense code</li><li>You will have to flip back and forth throughout the book</li><li>Logically think why a change is necessary</li><li>These challenges are meant to be tough: “<em>this should take you days</em>”</li></ul><p>Part 3 — Single Chapter:</p><ul><li>Walks through the case studies and why certain practices were applied</li><li>The case studies include a reference to the [H] (heuristic) that was applied. “<em>It is not the heuristics themselves that are so valuable it is the relationship…” — [Introduction XXVII]</em></li></ul><p>Anyways, let’s try and get through this together. This will take work and it will be a learning curve for me. See you all later this month.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e32ad8f686d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>