<?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: ZachJDev</title>
    <description>The latest articles on DEV Community by ZachJDev (@zachjdev).</description>
    <link>https://dev.to/zachjdev</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%2F272435%2F64d7581e-9481-4a75-998b-451fa333570f.png</url>
      <title>DEV Community: ZachJDev</title>
      <link>https://dev.to/zachjdev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zachjdev"/>
    <language>en</language>
    <item>
      <title>The Mistakes I made (and Headaches I Caused Myself) when Writing My First Real App</title>
      <dc:creator>ZachJDev</dc:creator>
      <pubDate>Wed, 11 Dec 2019 12:09:56 +0000</pubDate>
      <link>https://dev.to/zachjdev/the-mistakes-i-made-and-headaches-i-caused-myself-when-writing-my-first-real-app-5b8a</link>
      <guid>https://dev.to/zachjdev/the-mistakes-i-made-and-headaches-i-caused-myself-when-writing-my-first-real-app-5b8a</guid>
      <description>&lt;p&gt;I have learned a lot in my three months of earnest web-development study, so I figured now is the perfect time to reflect on the project that kickstarted my journey, and all of the lousy code that held it together.  &lt;/p&gt;

&lt;p&gt;I was asked to find a way to track all of the roles, competencies, and skills that my division in my institution would ever need to teach other divisions.&lt;/p&gt;

&lt;p&gt;Now, I did not consider myself a programmer when I started the project. My materials were meager: I had a pen, some paper, Excel and an internet connection (maybe not so meager given that last one). Every test that passed and every variable that Debug.print-ed correctly was a miracle to me.&lt;/p&gt;

&lt;p&gt;A week after starting, I turned in a hot mess of 1000 lines of VBA code and eight userforms built on top of two Excel worksheets.&lt;/p&gt;

&lt;p&gt;Looking back, I made a lot of mistakes. &lt;/p&gt;

&lt;p&gt;Here are four of them.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. I relied on barely-descriptive variable and function names.
&lt;/h3&gt;

&lt;p&gt;This first mistake stepped on my toes constantly. Oh, I want to iterate over the array of skills I just entered? Would that be &lt;code&gt;arr&lt;/code&gt;, &lt;code&gt;skills_arr&lt;/code&gt;, or &lt;code&gt;newSKills_arr&lt;/code&gt;? My functions were worse, with names like &lt;code&gt;arrayCheck&lt;/code&gt; -- a datatype and a terrible, no-good, non-descriptive verb.&lt;/p&gt;

&lt;p&gt;My program was short enough for this to be a nuisance at worst, and thankfully I am the only person who will ever read the code. But add a few hundred lines and give it to someone else, and I bet they'd be pulling their hair out in minutes.&lt;/p&gt;

&lt;p&gt;I give this three headaches out of five.&lt;/p&gt;

&lt;p&gt;🤕 🤕 🤕 · ·&lt;/p&gt;

&lt;h3&gt;
  
  
  2. I repeated myself and my code  many times.
&lt;/h3&gt;

&lt;p&gt;Why waste all that time writing a function whose name I won't remember when I can just copy-and-paste the code I need down here?&lt;/p&gt;

&lt;p&gt;Again, a big, annoying mistake that was only mitigated by my scale. &lt;/p&gt;

&lt;p&gt;🤕 🤕 🤕 🤕 ·&lt;/p&gt;

&lt;h3&gt;
  
  
  3. No comments, no documentation.
&lt;/h3&gt;

&lt;p&gt;Remember above, when I said: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;...and thankfully I am the only person who will ever read the code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That was a bit misleading because I will never read this code again. And if I do, I wouldn't know where to start. The only comment I made was to attribute a quicksort algorithm I got from StackOverflow. The code is unclear enough, and the lack of comments makes it nearly impossible to figure out.&lt;/p&gt;

&lt;p&gt;🤕 🤕 🤕 · ·&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Too much code lived in the global scope.
&lt;/h3&gt;

&lt;p&gt;This one was due to deficient knowledge of VBA and, unlike the other mistakes on this list, I tried my best to deal with this while I was working on the code.&lt;/p&gt;

&lt;p&gt;The only way I was able to regularly and successfully pass data between my forms was to stick a variable in the global scope for all to see. There's probably a way around this, but I was having trouble getting other solutions to work.&lt;/p&gt;

&lt;h4&gt;
  
  
  Now, I hope it's clear what kind of mess I got myself into:
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;I move a lot of code to the global scope to make it accessible by different forms.&lt;/li&gt;
&lt;li&gt;My terrible naming conventions meant that a lot of variables, previously tucked away, were now colliding, and I was calling different things by the same name.&lt;/li&gt;
&lt;li&gt;The lack of comments (and generally poor style) meant that figuring out where these variables were called and what I was doing to them was more work than it should have been.&lt;/li&gt;
&lt;li&gt;Repeat the above process about 100 times, because I couldn't be bothered to keep my code DRY in the first place.&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;p&gt;🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 🤕 &lt;/p&gt;

&lt;p&gt;And that leads me to the biggest lesson I learned:&lt;/p&gt;

&lt;h3&gt;
  
  
  For developers, code usability is just as important as application usability.
&lt;/h3&gt;

&lt;p&gt;Small mistakes, minor annoyances, and careless style &lt;em&gt;will&lt;/em&gt; pile up.&lt;/p&gt;

&lt;p&gt;My constant refrain has been "it could have been worse -- at least my code was short and I was working alone", but the reality is that if I want to do this professionally, these things won't fly. &lt;/p&gt;

&lt;p&gt;My scale was small and I was alone. Dealing with these mistakes still took up 15 or 20% of my time. With 10 or 20 more developers and 100x to 500x more code, I would find these mistakes unacceptable. &lt;/p&gt;

&lt;p&gt;But this was an important lesson to learn, and I'm glad I got it out of the way so quickly.&lt;/p&gt;




&lt;p&gt;I know my mistakes and lessons probably aren't news to most people reading this, but thanks for reading this far anyway! Next time, I want to dive into a UX problem I created for myself -- one that I spent way to much time on, only to end up with something I hated using.&lt;/p&gt;

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