Warning: This is a long article.

sleeping programmer: photo credit: https://www.theguardian.com/commentisfree/2016/mar/07/secret-life-games-programmer

These photos are hilarious, they got me thinking of how programmers go through a lot of pain and sleepless night to get things done.

Though the photos above do not totally describe my life so far as a programmer, to a great extent, I can relate with them.

Have you worked on a project all day and all night and it still does not work? You perhaps even ended up opening the gate for more bugs.

I have gone through this countless times, I recall one of such experiences: I was working on a program that collects data from students and gives outputs based on the input. I was using JavaFX (Java’s sophisticated platform and UI toolkit/Library).

It was hard getting the program to display from a List I created based on the inputs of the user. I tried for hours to get the program to work, looked the code over and over again (this was not just one file, it was a host of Java files), used alternative methods to see if my approach was wrong, rewrote the code blah blah- none of these solved the problem.

After battling with the program for hours, I shut my computer in frustration and left (one of the programming tips I will be sharing below), or I think I decided to see a movie instead, can’t really recall. When I came back to the code, I spotted the bug at first glance. It was not a ‘bug’ as programmers know it, calling it a mistake will be more appropriate. I discovered there was no way the program could display the list because I had not passed the list to the UI widget, the UI list widget was empty.

Programmers do not only have sleepless nights over bugs and product issues, but they also spend a lot of time reading books, articles, Q&A sites, video tutorials, learning new things and searching for easier and more efficient ways to solve a problem. They are constantly surrounded with new things to learn (JavaScript users will attest to this); new technologies spring up daily, new programming languages, libraries, and frameworks -that makes what you currently know and use seem obsolete- crawl to life as we wake up daily. (I bet Kotlin gave some Java programmers nightmares).

As such, programming becomes daunting and tedious –especially to learners like me who are just trying to get their feet on the ground. We are sometimes tempted to give up and quit the rat race.

This is the daily lifestyle of programmers; and in my course of coding and learning, and passing through these experiences, I have learned a handful of ways to handle these situations and ease the pain of programming. I am going to share these techniques with you; I learned them both from friends, online materials and personal experiences. If you care, you can share it so others can read and learn.

1. Fixing bugs is part of programming: Just so you know; you won’t always get it in the first attempt, so get your mind ready to fix the bugs that you’ll eventually create, they will surely rear up their heads.

2. Leave it and come back later: A mentor taught me this, and it has been working. When it seems your code isn't working and you have spent hours on it, just leave it for a while, take a short rest, a walk or see a movie and come back again, maybe what you actually need is a little distraction.

3. Reach out to a friend for help: You will surely get the issue fixed if you do it all alone, but it might take a long time, and I bet you do not have all the time in the world to waste on one project. After much personal efforts on trying to fix the issues on your code without success, reach out to a friend who codes; most times the first person to look at your code spots the fault and provides the solution.

4. Use Stackoverflow, use Quora: Your friend couldn’t help you? You have tons of other friends online who have faced the same problem and have solved it.

5. Keep calm, we all know programming is hard: The fact is programming is hard, I have seen programmers who have been coding for years, still finding certain things difficult. So keep calm, it will get easier as you go.

6. Start with the essentials: The number of frameworks and programming languages is enormous and still growing. The fact is you do not have to learn everything, learn the basics of a programming language and use the frameworks and libraries as needed for your projects.

7. Use the modular design pattern: Do not cluster your entire product code in one file or two. Use multiple files to handle separate operation and functions; this does not only makes debugging easy and fast, but it also makes your codes reusable for other products development.

8. Be smart, share the burden and collaborate: If you think you can handle the project by yourself, fine, but I bet you it will be better if you get extra hands on your project. Get in touch with friends (online or offline) and invite them to join you on your project. Collaborating makes your project move fast, debugging easier and faster, improves the functionality of the product and makes life sweet and fun.

It is hilarious how programmers stay all day and all night trying to fix bugs or introduce new features to a product and it doesn’t seem to be working as expected — a comma, dot or space, can be the cause of your life’s troubles. This is what programmers spend most of their time on fixing bugs.

If you code, I believe you can relate with this article, What funny or annoying experience have you had as a programmer? Share in the comment box below. If you found this article interesting, share it with your friends. Follow this publication to receive my future articles first hand. If you care, you can follow me on twitter, I constantly make awesome and interesting tech tweets.

Code on.