5 Ways to Make Programming Less of a Nightmare

Credit: HubSpot

Programming can be scary.  There are plenty of things that can go wrong, from haunting errors to seemingly supernatural result inconsistencies.   To help keep the ghosts in the machine from getting the best of you, here are some tips my co-workers and I have picked up over the years.


 1)  Make a rough draft

Just like writing a paper, programming requires some forethought.  When you’re given a new programming problem it is always tempting to start coding right away, especially if you are in a rush.  However, taking the time to make an outline of your program first will save you lots of headaches later.  Even if it is a seemingly simple problem, think about what methods and helper methods you are going to need, what variables they will take, and how they will interact.  It is generally easier to debug code errors than logic errors, so work out the logic as much as possible before starting to code.

2) Listen to music

Having also tried TV, audio books, and silence, the best way I have found to stay productive while coding is to listen to some upbeat music.  It seems I am not alone in this opinion, as the internet has many playlists labeled specifically for programming. (In fact, we have a few of our own you might like.)  Music drowns out background noise but can easily be tuned out, keeping you focused and helping the time go faster.  So to prepare for your next coding marathon just put on your headphones.  Before you know it you will be halfway through your code and typing in beat to the music.     

3) Follow good stylistic practices

This might seem like rudimentary advice, but anyone who has ever dealt with inherited code knows that it is not always followed.  Even though it seems like you are saving time it is never a good idea to take shortcuts and skip things like good comments, proper indentation, and meaningful variable and method names.  Following these practices makes your code far more readable and accessible.  You and anyone else who has to look at your code in the future will appreciate not having to reverse engineer the program to understand what it does.

4)  Ask other programmers

Sooner or later you are going to run into an error, but luckily you are not alone.  One of the best things about being a programmer is belonging to the global programming community.  Regardless of what error or trouble you are having with your code, there is almost certainly someone who has had that same problem and is willing to help you solve it.  These people could be your co-workers, classmates, teachers, or anonymous users on internet forums.  Thanks to all these helpful people there are plenty of places to find answers, and more often than not they can be found with a quick Google search.

5)  Stop thinking about it

If you’ve been working on the same bit of code for 5 hours with no results, trying the same thing for another hour is not going to get you anywhere.  The best thing you can do is take a break.  Take a nap, get some coffee, watch TV – whatever will get your mind going in a different direction.  I have found that it is not uncommon for the solution to suddenly occur to me while I’m away from the computer.  Even if your break does not lead to an epiphany, it will make you more productive when you return to your code.

So the next time your code is giving you a run for your money, don’t go screaming in the other direction. Take a look back at these tips to get you back on track.

Need some coding inspiration? Take a look at our playlists to find your programming groove.

Related posts:

Leave a Reply

Your email address will not be published. Required fields are marked *