<?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: rconr007</title>
    <description>The latest articles on DEV Community by rconr007 (@rconr007).</description>
    <link>https://dev.to/rconr007</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%2F221813%2F76b7a14c-77da-4b8a-9da6-b4efe88dd551.png</url>
      <title>DEV Community: rconr007</title>
      <link>https://dev.to/rconr007</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rconr007"/>
    <language>en</language>
    <item>
      <title>The Importance of naming in code...</title>
      <dc:creator>rconr007</dc:creator>
      <pubDate>Wed, 31 Mar 2021 22:48:46 +0000</pubDate>
      <link>https://dev.to/rconr007/the-importance-of-naming-in-code-pg0</link>
      <guid>https://dev.to/rconr007/the-importance-of-naming-in-code-pg0</guid>
      <description>&lt;p&gt;Choosing appropriate names when coding is always a good idea. IMHO. Many think that using cryptic, (single, double, triple) letters for naming is appropriate. Unfortunately, I beg to differ. we are forgetting one thing: &lt;strong&gt;"We don't code for machines, we write for humans!"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We spend the majority of our time reading code which accounts for 60-70% of our coding time and the remainder writing it. If we write code to be understood at a later time. Then shouldn't we always choose meaningful names? Wouldn't you agree? I don't know about you but I write and forget practically the very next day if I don't need to touch the code for a while. This is my own way to keeping sane and not storing or perhaps, I can say it in a nicer way: not overloading my brain with extra information, not required for my everyday upkeep. ;-)&lt;/p&gt;

&lt;p&gt;A simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const a = [10, 5, 50, 6];
let t = 0;
for(i=0; i &amp;lt; a.length; i++){
   t += a[i];
}
console.log(t);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you read the example above you will be able to follow it very simply as you are only dealing with a couple of variables. But you won't be able to follow the intent (or reason) why this code block was created.&lt;/p&gt;

&lt;p&gt;Let's take the same example and add meaningful names to our variables and put some additional thoughts into our coding habits.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const priceList = [10, 5, 50, 6];
let totalPurchasedPrice = 0;
for(index=0; index &amp;lt; priceList.length; index++){
   totalPurchasedPrice += priceList[index];
}
console.log({totalPurchasedPrice})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I think you know where I am going with this. At a glance you don't have to think too much to know that someone is taking a list of prices, iterating over them and arriving at the &lt;em&gt;Total Purchased Price.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You are probably going to say that the names are too long. Or that you don't need anyone else to read your code. I can argue that with minification the first issue will be taken care of. Specially with libraries and frameworks like ReactJs and Angular. But ultimately, I would like to leave you my intro statement: &lt;strong&gt;"We don't code for machines, we write for humans!"&lt;/strong&gt; Save the sanity of your future self and those of your coding colleagues.&lt;/p&gt;

&lt;p&gt;D-Agency&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
  </channel>
</rss>
