<?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: Félix Dion-Robidoux</title>
    <description>The latest articles on DEV Community by Félix Dion-Robidoux (@fdrobidoux).</description>
    <link>https://dev.to/fdrobidoux</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%2F235590%2Fc6a9f677-19f1-4458-a8b6-4b858e4f04cd.jpeg</url>
      <title>DEV Community: Félix Dion-Robidoux</title>
      <link>https://dev.to/fdrobidoux</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fdrobidoux"/>
    <language>en</language>
    <item>
      <title>PSA: Stop using Streams and Reader/Writers to Convert Strings/ByteArrays</title>
      <dc:creator>Félix Dion-Robidoux</dc:creator>
      <pubDate>Wed, 28 Jul 2021 13:16:37 +0000</pubDate>
      <link>https://dev.to/fdrobidoux/psa-stop-using-streams-and-reader-writers-to-convert-strings-bytearrays-2n05</link>
      <guid>https://dev.to/fdrobidoux/psa-stop-using-streams-and-reader-writers-to-convert-strings-bytearrays-2n05</guid>
      <description>&lt;p&gt;Stop doing this :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;MemoryStream&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;StreamWriter&lt;/span&gt; &lt;span class="n"&gt;writer&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;StreamWriter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Encoding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ASCII&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;lineData&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;dataLines&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lineData&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="n"&gt;writer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Flush&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;memory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetBuffer&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Just... do this instead :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;Encoding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ASCII&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetBytes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lineData&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"\n\r"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Trust me, it's not worth using streams unless you &lt;strong&gt;explicitly&lt;/strong&gt; need to.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>codequality</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Using 🎉Emojis💎 when naming Pull-Requests</title>
      <dc:creator>Félix Dion-Robidoux</dc:creator>
      <pubDate>Tue, 10 Mar 2020 00:18:21 +0000</pubDate>
      <link>https://dev.to/fdrobidoux/using-emojis-when-naming-pull-requests-190k</link>
      <guid>https://dev.to/fdrobidoux/using-emojis-when-naming-pull-requests-190k</guid>
      <description>&lt;p&gt;Today, I started my new job at &lt;a href="https://jstrategia.com/"&gt;JStratégia&lt;/a&gt; as a mobile developer. For the first 4 hours, I worked on setting up my brand new Lenovo Thinkpad (never had one, they're sweeeeet !), getting my emails set up on both mobile and on the laptop, meeting the team...&lt;/p&gt;

&lt;p&gt;And then I was explained for the remaining 2 hours how the neighboring team worked for the past 6 months, and it was a mindblowing experience.&lt;/p&gt;

&lt;p&gt;One of the biggest revelations I had out of the many great practices they had within their git workflow, was to use emojis at the beginning of the title of the pull request. This might sound odd at first, but here's some examples :&lt;/p&gt;

&lt;p&gt;If it's a feature, name it, for example :&lt;br&gt;
&lt;code&gt;🎉 Mobile : Responsiveness to sales view&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If it's a bugfix, use this :&lt;br&gt;
&lt;code&gt;🐛 Apache : Access to root from a regex pasted in url&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For adding tests :&lt;br&gt;
&lt;code&gt;☑ Setup : Compat. Linux, Mac OS, Windows and Solaris&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In case you're upgrading a library the project depends on or adding new ones :&lt;br&gt;
&lt;code&gt;📚 NPM : leftpad 2.0.2 to 2.1.4&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;When it involves the documentation :&lt;br&gt;
&lt;code&gt;🗒 Deployment : Extra troubleshooting&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This has multiple advantages :&lt;/p&gt;

&lt;h2&gt;
  
  
  1. It's fun
&lt;/h2&gt;

&lt;p&gt;Well, duh. Emojis are fun. 💩&lt;/p&gt;

&lt;h2&gt;
  
  
  2. It's easier to give a meaningful, but descriptive title.
&lt;/h2&gt;

&lt;p&gt;You can waste a lot of time trying to conjugate your sentences in a coherent manner, but here you'll keep it short and sweet.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. It'll give quick-scan skills to reviewers
&lt;/h2&gt;

&lt;p&gt;You won't feel guilty of writing "Fixed deployment bugs" and fear that any extra details will be glossed over if you add anything more, but reducing on details won't help either. Plus, there is now a clear distinction between category, sub-category and description.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. You can count 'em !
&lt;/h2&gt;

&lt;p&gt;When you'll be making a post-mortem, you'll be able to easily count emojis by making a search for them and counting the results for every time they come up. This means you can count how many times bugs, features, documentation and testing were worked on, and compare with past projects to get a feel of what's been prioritized the most.&lt;/p&gt;

&lt;p&gt;So, what do you folks do at work to improve your git workflow ? I'd love to know !&lt;/p&gt;

</description>
      <category>todayilearned</category>
      <category>git</category>
      <category>github</category>
    </item>
    <item>
      <title>Asynchronous calls and assignments using Tuples to reduce if...else hell</title>
      <dc:creator>Félix Dion-Robidoux</dc:creator>
      <pubDate>Wed, 26 Feb 2020 15:38:19 +0000</pubDate>
      <link>https://dev.to/fdrobidoux/asynchronous-calls-and-assignments-using-tuples-to-reduce-if-else-hell-5c3</link>
      <guid>https://dev.to/fdrobidoux/asynchronous-calls-and-assignments-using-tuples-to-reduce-if-else-hell-5c3</guid>
      <description>&lt;p&gt;Don't you hate having a huge amount of &lt;code&gt;if...else&lt;/code&gt; for multiple async operations in a single function? Those are the kind of code smells we're gonna look at here in this article.&lt;/p&gt;

&lt;p&gt;Take a look at the example below. It is heavily inspired from real production code in a basic ASP.NET controller method for a form that has an external REST API to fetch dynamic dropdown values.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;
&lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;HttpResponseData&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;obtainCategoriesTask&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_restApiClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;obtainDropdownValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"categories"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;HttpResponseData&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;obtainTagsTask&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_restApiClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;obtainDropdownValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"tags"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;HttpResponseData&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;obtainAuthorsTask&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_restApiClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;obtainDropdownValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"authors"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;categoriesList&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;obtainCategoriesTask&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;categoriesList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Success&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;tagsList&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;obtainTagsTask&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tagsList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Success&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;authorsList&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;obtainAuthorsTask&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;authorsList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Success&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Do stuff with the data&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"One of the API calls has resulted in an error."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"One of the API calls has resulted in an error."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"One of the API calls has resulted in an error."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, what's wrong with this code ?&lt;/p&gt;

&lt;h3&gt;
  
  
  1. It's not DRY.
&lt;/h3&gt;

&lt;p&gt;DRY means "Don't Repeat Yourself", which is a methodology that encourages processing a structured data pattern &lt;em&gt;(i.e. key/value for a dictionary)&lt;/em&gt; instead of typing more logic code (&lt;code&gt;if..else&lt;/code&gt;) when adding more functionalities.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. It isn't very scalable.
&lt;/h3&gt;

&lt;p&gt;Try adding a new task. You'll have to add another indentation of &lt;code&gt;if...else&lt;/code&gt; inside the &lt;code&gt;if (authorsList.Success)&lt;/code&gt; condition, and you'll also have to add an &lt;code&gt;else&lt;/code&gt; for errors, which most likely won't be as simple as I've shown.&lt;/p&gt;

&lt;h2&gt;
  
  
  First, make it DRY.
&lt;/h2&gt;

&lt;p&gt;Here's how you can make your code more DRY : You could use a structured data pattern. For this example, we'll use &lt;strong&gt;Tuples&lt;/strong&gt; !&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;callGroupsAPI&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Tuple&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyHttpResponse&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;,&lt;/span&gt; &lt;span class="n"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IList&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;()&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Tuple&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Create&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyHttpResponse&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;,&lt;/span&gt; &lt;span class="n"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IList&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;&amp;gt;(&lt;/span&gt;
        &lt;span class="n"&gt;_restApiClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;obtainDropdownValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"categories"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Do something with that list.&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;Tuple&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Create&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyHttpResponse&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;,&lt;/span&gt; &lt;span class="n"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IList&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;&amp;gt;(&lt;/span&gt;
        &lt;span class="n"&gt;_restApiClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;obtainDropdownValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"tags"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Do stuff with list&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;Tuple&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Create&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MyHttpResponse&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;,&lt;/span&gt; &lt;span class="n"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IList&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;gt;&amp;gt;(&lt;/span&gt;
        &lt;span class="n"&gt;_restApiClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;obtainDropdownValues&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"authors"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="c1"&gt;// Do some other stuff using said list&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I've made a list of &lt;code&gt;Tuple&lt;/code&gt; objects where : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Item1&lt;/code&gt; is of type &lt;code&gt;Task&amp;lt;HttpResponseData&amp;lt;DropdownValue&amp;gt;&amp;gt;&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;You might be asking what &lt;code&gt;HttpResponseData&lt;/code&gt; was this whole time. Simply, it's a custom response container. It could be anything else that an asynchronous method from your &lt;code&gt;_restApiClient&lt;/code&gt; wants to return.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Item2&lt;/code&gt; is of type &lt;code&gt;Action&amp;lt;IList&amp;lt;DropdownValue&amp;gt;&amp;gt;&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;The function we keep there does not return anything yet but expects to receive a response object as an entry parameter. You could, for example, take the list of dropdown values contained in the response and add them in the &lt;code&gt;ViewBag&lt;/code&gt; to use them in your view.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Then, scale the processing.
&lt;/h2&gt;

&lt;p&gt;Here's the tricky part. We're gonna have to use this data structure in a generic way. This will ensure of its reusability, entensibility and having to write the same instruction multiple times, which helps with readability.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;MyHttpResponse&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WhenAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;callGroupsAPI&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;

&lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;callGroup&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;callGroupsAPI&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsFaulted&lt;/span&gt; &lt;span class="p"&gt;||&lt;/span&gt; &lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsCanceled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"One of the API calls has resulted in an error."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Succes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;ViewBag&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Understandably, this is a lot to take in. Let's go step-by-step with this snippet.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Declare the result
&lt;/h3&gt;

&lt;p&gt;We declare a result object for convenience. 'Nuff said.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;MyHttpResponse&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DropdownValue&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Await all the tasks
&lt;/h3&gt;

&lt;p&gt;Here, we await all the tasks at the same time by doing, for convenience, a quick LINQ query on &lt;code&gt;Item1&lt;/code&gt; of each &lt;code&gt;Tuple&lt;/code&gt;. This is necessary in order to "activate" the asynchronous tasks within each &lt;code&gt;Tuple&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;WhenAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;callGroupsAPI&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Select&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Go through every callGroup
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;callGroup&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;callGroupsAPI&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember that &lt;code&gt;var&lt;/code&gt; is of type &lt;code&gt;Tuple&amp;lt;Task&amp;lt;MyHttpResponse&amp;lt;DropdownValue&amp;gt;&amp;gt;, Action&amp;lt;IList&amp;lt;DropdownValue&amp;gt;&amp;gt;&amp;gt;&lt;/code&gt;, which is quite a mouthful, I admit.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Check for issues once it's done.
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsFaulted&lt;/span&gt; &lt;span class="p"&gt;||&lt;/span&gt; &lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsCanceled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"One of the API calls has resulted in an error."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since the &lt;code&gt;Task&lt;/code&gt; object contains the state of their respective asynchronous process, we don't lose any of the context from doing the previous &lt;code&gt;await&lt;/code&gt; on every &lt;code&gt;Task&lt;/code&gt; object; We just have to check their status, and if they failed, we throw an exception using the &lt;code&gt;Task&lt;/code&gt; object's internal exception.&lt;/p&gt;

&lt;p&gt;By then, it will wait for that first task to be done before it gives us a result, but while this is happening, the other tasks could be still running (or be done by then), which is exactly what we want !&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Keep the result
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Protip:&lt;/strong&gt; The previous step's &lt;code&gt;throw&lt;/code&gt; gets us out of our &lt;code&gt;for&lt;/code&gt; loop if it ends up &lt;code&gt;true&lt;/code&gt;, so no need to use a &lt;code&gt;else&lt;/code&gt; statement here.&lt;/p&gt;

&lt;p&gt;We can just add the result (which we should have by now) to our temporary &lt;code&gt;result&lt;/code&gt; variable, for convenience.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. Reach for success
&lt;/h3&gt;

&lt;p&gt;This is the cool part : We manually call &lt;code&gt;Invoke()&lt;/code&gt; on the callback contained in &lt;code&gt;Item2&lt;/code&gt; for the current &lt;code&gt;callGroup&lt;/code&gt;, but we pipe in the response directly. Thus, every async call does its own thing it needs to; The instructions were declared in each Tuple's second item!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Success&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;callGroup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Item2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Invoke&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Do note, your mileage will vary on how you'll check for the API's success; &lt;code&gt;MyHttpResponse&amp;lt;T&amp;gt;&lt;/code&gt;I is a custom object I send and deserialize from every REST API calls done in this project, but you could use a &lt;a href="https://docs.microsoft.com/en-us/dotnet/api/system.web.httpresponse"&gt;&lt;code&gt;System.Web.HttpResponse&lt;/code&gt;&lt;/a&gt; just as easily and then deserialize the body. This is out of the scope from this lesson, however.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. If all else fails...
&lt;/h3&gt;

&lt;p&gt;In case the boolean indicating for success returns false, we indicate that by adding the error message from our result object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;else&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ViewBag&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Error&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;break&lt;/code&gt; keyword is for quitting the &lt;code&gt;for&lt;/code&gt; loop, so we can show the error in our view without wasting any more time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Feedback
&lt;/h2&gt;

&lt;p&gt;I'd like to get as much feedback as possible for this tutorial, I'm new to writing here and I'll be honest, English isn't my main language. If there's anything that didn't make sense with the way I phrased things, or anything else, feel free to tell me about it in the comments, I'll adapt for my next articles.&lt;/p&gt;

&lt;p&gt;Thanks for reading, and I hope you learned something new !&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>tutorial</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Your codebase is like your house.</title>
      <dc:creator>Félix Dion-Robidoux</dc:creator>
      <pubDate>Thu, 20 Feb 2020 18:10:00 +0000</pubDate>
      <link>https://dev.to/fdrobidoux/your-codebase-is-like-your-house-4c5k</link>
      <guid>https://dev.to/fdrobidoux/your-codebase-is-like-your-house-4c5k</guid>
      <description>&lt;p&gt;Today, I was reading my LinkedIn feed, trying to find some inspiration, and I came across a post describing code reviews in a way I never thought before.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/posts/remygendron_want-a-quick-and-easy-way-to-improve-your-activity-6636255955266920448-UkhU"&gt;The post&lt;/a&gt; talked about how you should treat the codebase as if it was your house, which sounds profoundly asinine at first, but... is it really?&lt;/p&gt;

&lt;p&gt;I've found some good wisdom from this post and I wanted to expand on it. But first, let's take a step back. &lt;/p&gt;

&lt;p&gt;Imagine you're renting an appartment. The floor and walls are old and door hinges haven't been fixed in a while but they still can pivot.&lt;/p&gt;

&lt;p&gt;You sign the paperwork, get your furniture in, and everyday you will get inside and live in it. As time goes on, you will keep on adding more things in it, sometimes consciously or unconsciously. Those things can be the unread mail piling on, unfinished drinks that were left on your coffee table, the bookshelves slowly filling with dust, the trash bags filling in with smelly shrimp outer shells, the dirty cauldron you used for that delicious chili you're so proud of, the leftovers of said chili you left in the fridge for way too long... &lt;/p&gt;

&lt;p&gt;All those things will inevitably happen as you spend time living in your home every waking moment. And while you could pay for services that will reduce or mitigate the problems (ex. deliveries and cleaning), you still haven't fixed the core problem : You.&lt;/p&gt;

&lt;p&gt;Yes, you. Your habits in spendings, for social and pleasure, your discipline, your anxiety, and maybe even your alcoholism or drug habits. Those are the key points why you're not taking care of these issues. It's not the landlord's fault nor is it your roommate's, despite feeling the need to blame that landlord for selling you that house or the roommate for not doing anything about it and setting a precedent. Responsibility must be taken by someone, and that someone is gonna be you, because it is your house after all.&lt;/p&gt;

&lt;p&gt;You might be thinking "Well, I still am able to live here, and to do my daily routine and make it feel like home" but soon you'll find you have a sink tap that seldom unlocks from its inner mechanism, the water runs on both the bath and shower resulting in lower pressure from the showerhead, or the wall-hung coat hanger that unbolted itself from the wall due to having too many coats pulling outward, so your only solution is to leave your winter coats on the living room chairs...&lt;/p&gt;

&lt;p&gt;Ignoring the problems will probably win your more time for relaxing and living in your home without worries, but those debts will only keep increasing and causing more compromises to be made.&lt;/p&gt;

&lt;p&gt;And then you invite people over.&lt;/p&gt;

&lt;p&gt;If you don't keep your home clean when they arrive inside, they'll see it instantly. And they will understand where your priorities are. &lt;/p&gt;

&lt;p&gt;Fortunately, in the context of code reviews, they will be more willing to give feedback, but in both cases, the fact you invite people over to look at your code or spend time at your crib will make you care more about your work.&lt;/p&gt;

&lt;p&gt;Essentially, this has been a core issue I felt about every work contracts I've had for the past year and a half. All were under monolithic codebases that focused on delivering business value and rarely ever cared about ensuring the next guy who reads the code feels "at home", because not a lot of people really did code reviews.&lt;/p&gt;

&lt;p&gt;Add that I forced myself to work extra hours to fix issues that were ommited by past contributors/tenants and I was on a prescribed 40mg dose of Adderall (a drug that helps with my ADHD but at 26 years old only really makes me grumpy, anxious and force myself to ), to say I felt miserable would be an understatement.&lt;/p&gt;

&lt;p&gt;And then they let me go because I had enough and used a loud drill to attempt at fixing those issues, which none of the other tenants were happy about.&lt;/p&gt;

&lt;p&gt;Code quality is like keeping your home tidy. It's important.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;By the way, I'm a young developer who's looking for work in Québec City and in a year around Dallas, TX. Hit me up with offers if you want me in your team !&lt;/em&gt;&lt;/p&gt;

</description>
      <category>codequality</category>
      <category>todayilearned</category>
    </item>
  </channel>
</rss>
