Everybody makes mistakes. And that’s a good thing! Mistakes are an essential ingredient of learning (albeit learning the hard way), and if you’re smart enough you never make the same one twice. When it comes to programming however, there are several ‘hallmark’ mistakes that every single coder has made at one point in time – no matter how senior or revered or well known they eventually become. If you’ve already made all of these and learned valuable lessons as a result, consider yourself well on your way to programming excellence. If you’ve yet to make any of them, well, don’t say we didn’t warn you.
#1: Overcomplicating Things
Hey, we get it. There’s more than one way to solve pretty much any problem, and half the fun of programming is in exploring and executing those solutions. But guess what? Sometimes (most of the time, in fact) the simplest solution is the best one. Coming from a scientific background, most programmers tend to get caught in a rabbit hole of code when building something. There are just three things you need to remember, in the following order. First, make it work. Then, make it right. And only then should you worry about making it fast. In other words, keep it simple and take your time!
#2: Underestimating Time
If you have high hopes of becoming a freelance programmer, this is one mistake you need to make as early as possible. Coders are notorious for underestimating the amount of time something will take. No matter how concisely you write or how well you’ve planned everything, there will be bugs. Some only take seconds to fix, and some do not. Despite it being entirely based on logic, coding never goes entirely to plan. The sooner you learn this, the better! Always work extra time into your plan for unprecedented road blocks, because they will happen. All the time.
Adopting a consistent coding style is imperative for any programmer, but many don’t figure it out until they’re well into intermediate territory. Deciphering what all-caps or indentations signify may only take a second of your time, but those seconds add up and use a chunk of brain power that could be employed elsewhere – i.e. for important stuff. If you figure out a consistent system now and STICK TO IT, you instantly streamline your programming and free up all those brain cells for the stuff that really matters – actually building things.
#4: Temporary Fixes
In an effort to save time – the time lost being a result of the first three mistakes on this list – every coder will at one point in time have said ‘this is a bug, here’s a temporary fix that I’ll return to once everything else is finished’. And lo and behold, you never return to it. Not only does this make your code imperfect and unstable, it’s also downright lazy. If your temporary fixes become a lifetime habit, everything you build will be on shaky foundations (it sounds dramatic, but it’s true!). Avoid temporary fixes altogether by getting your code right from the start. Make a detailed plan before you write a single line of code, and… keep it simple!
#5: Big Functions
New coders always end up writing functions that are way too big. It’s an easy mistake to make; it just naturally happens when you start writing lines of code. But every function that’s over 50 lines or so can very possibly be broken down into multiple smaller, simpler sub-functions. This is most definitely better, because large functions are extremely difficult to debug. In fact, there’s basically no scenario in which big functions work. Just don’t it.
#6: Lack of Testing
Plan the program. Build the program. Run the program. Job done, right? Wrong. Far too many programmers spend far too little time testing. If you don’t know what will happen to your program if you reboot your database for example, or if you flush al your caches, then you haven’t done enough testing. And, most likely, you won’t know how to fix it quickly and easily, which is also pretty bad. It’s not enough to test ‘if’ something works. You need to actively try to break it too! Not only will it test the durability of your code, it also makes you a better programmer because you understand your code on an entirely new level.
#7: Not Backing Up!
You’d think computer-savvy people would be meticulous about backing up their work twice, three times and more. But no. Even expert coders have fallen into the trap. You don’t want to stop the workflow when you’re in the zone; you didn’t set up any kind of autosave system, but you’ve decided to take the gamble; you lose everything when something crashes. It happens far more often than you’d expect. And the solution is so simple; inexpensive systems can automatically back up your entire disk every night, or you can use Dropbox or any other cloud storage system. It’s that easy. There is no excuse!