The Easiest Way to Create A Solution That Works

The easiest way to create a solution that works…is to do it right the first time. Yes, this is a bit of a cop-out, but it turns out to be an important factor to keep in mind when you are tempted to come up with a quick and dirty solution for a problem that does not follow established best practices and is likely to have code quality issues later.

I have run across many sections of code that I or other developers have written in the past that we thought were “good enough” at the time it was written, yet, I was revisiting the code because we discovered a bug in it. Many times, this code had an issue that would have been trivial to fix at the time it was written, if it were only found. It seems that as a developer, we tend to find the least sufficient solution that will solve the immediate problem we are experiencing instead of finding an optimal solution that will be easily maintained months and years after it was written.

As a result of having to go back and fix so many trivial errors throughout the codebase, I am working towards being more diligent when it comes to ensuring my code meets all code quality and style guidelines. In addition, for code reviews, I look for a way to gently point out stylistic and code quality issues that don’t adhere to team standards, assisting the author with correcting the issues where necessary. My goal is to ensure that I do all I can to avoid being part of shipping more defects in code that is headed to production than defects we are fixing with the code change being shipped.

If we write great code the first time, it keeps us from having to come back and rewrite our code later.

comments powered by Disqus

Related Posts

== and === in JavaScript and HTML Input Elements

If you read any current information about best practices in JavaScript, you will typically find the following advice somewhere in the list of things to do. Always use === and !== while avoiding == and != While I will never argue against this advice, there are a few things that a developer shoule realize when using === and !== instead of == and !=. === and !== first do a check of the data type of the two objects you are comparing.

Read More

Avoid SiteCatalyst's useForcedLinkTracking and target="_blank"

All sites rely upon some third party analytics software to track at the very least the number of visitors to a site. Many sites use Google Analytics, which provide much more information that just the number of visitors. Another option that some of the bigger sites use is Adobe Analytics, aka SiteCatalyst to enable more custom tracking options that are not evident through the Google Analytics interface. One feature of SiteCatalyst is that it allows you to set an option useForcedLinkTracking that will track every link on your site for clicks whether or not you have setup custom tracking for the links or not.

Read More

AddThis Can Cause Your Site To Not Load

Over the last few days, I have run across quite a few websites that seem to never finish loading. After waiting for 20 seconds or more, I give up, realizing that whatever content was on the site wasn’t worth it anymore for me to stare at a blank white browser until it loaded however much longer. Unfortunately for those websites, they are losing traffic that they will never get back.

Read More