When you are stuck as a developer/software engineer, what do you do? 8 tips to jump out.

When you are stuck as a developer/software engineer, what do you do? 8 tips to jump out.

Walk and Talk - Episode 4

ยท

5 min read

As a developer/ software engineer, have you ever been stuck at a code? It like asking someone "Do humans walk with legs?". The answer is simple. YES and YES!

But, the next question would not be simple as it seems. What do you do when you get stuck at a code? Everyone might have different approaches. But since this is my article, I'll share mine ๐Ÿ˜‹

A developers' life is not cool as it is advertised or as other people see. "Whoa, a cool guy with a headset and a computer". Is it actually cool? Only the developers know the answer to that question because only us know how much we scratch our heads after getting stuck at code. So, apart from scratching our heads, what we can do to get out of it?

68bbfbeff7e1861cfa8b1a2b8eeb3d72.gif

Breath, and take a step back from your chair

Everyone needs a small break once in a while. Your brain does too. Without a little break, you beta wave activity in brain can get slightly high and it can cause you stress. Stress will definitely block your brain from generating new ideas and solutions. When you get stuck in a code, you usually think a lot about the situation and try to get out of it. But without knowing, it can get you deeper into the problem and it will make you exhausted and un-see the solution.

So, take a little break, look at your surroundings and specially make your self calm. Everyone has different ways of making themselves calm. Some needs meditation, some needs a little encouragement and some needs music or games. It actually does not matter how you make yourself calm. If you need to scream at a wall to make yourself calm, I suggest you to do it.

Make a mind map

Now, since you have calmed yourself, you can take a different approach to find the solution. Have you ever tried creating a simple mind map before doing the developments on your feature. If you have not yet, better to make a mind map now. Because there is a high chance that you find an alternate way to figure out the same problem that you are stuck right now. Just take a pen and paper, or open a OneNote.

Rubber duck debugging or Rubberducking

Rubberducking? Yep it is a word that has been created only for these kinds of situations. I have experienced the same situation, but unfortunately not with a duck. It is very simple. When you are stuck at a code, you can ask a solution from a person. When you do, you explain the situation from the beginning. Most of the times, before you complete the explanation, your light bulb will work and you will see the solution in your head. This has happened to me numerous times. Rubber duck debugging is also the same. Instead of a real person, you get a inanimate object or your favorite pet, and start explaining the situation like to a real person. Most of the times, your light bulb may work.

Take a powernap

Powernap is a quick sleep between 15 - 30 minutes. Power naps have health benefits such as improved memory, cognitive performance, and better logical reasoning. However, excessive napping can disrupt a person's circadian rhythms, leading to increased exhaustion.

After waking from a powernap, you and your brain will feel refreshed and you may get new ideas to get out your problem. Again, if you are taking a powernap, make sure to do it in less than 30 minutes.

Reading documentations

This will work only if you get stuck while integrating a 3rd party system or a library. The solution is sometimes already there in the documentation, as an alternative or an example. Check the documentation for the right version of the library. For huge libraries, I prefer to browse the full API page - occasionally the information you're searching for is there, but with a completely different name.

git bisect

You probably have not heard this before. git bisect employs a binary search method to determine which commit in the history of your project created a bug. You apply it by first giving it a "bad" commit that is believed to include the bug as well as a "good" commit that is confirmed to be prior to the introduction of the bug. Then git bisect chooses commits among these two endpoints and offers you whether it is "good" or "bad." It narrows the range more until it discovers the specific commit that caused the change.

Write a Unit Test

A unit test is written to test most basic testable component of a program, such as functions, classes, procedures, and interfaces. Individual pieces of source code are examined to see if they are fit for use, using unit testing. I you do not have a unit test, guess it is time to write one. You will be able to see what causes you to stuck at your code.

Stack Overflow

If you are in a hurry, this should be your number one. But, if you are not, this should be the last. There is a very high chance that your problem was already a someone else's problem at the past. Look for the problem in Stack Overflow and there might be an answer. However, if you do this as the your first, you will miss making strategies and brainstorming to overcome your issue. Always and always, try to make a solution by yourself. It will improve your decision making and solutioning a lot better. But, as I said, if you are in a hurry, better to make this your priority.

Finally as always, you can ask from a senior or from a colleague for help if you get stuck on a code. But I suggest you to do everything you can do before asking help from someone else. There is no shame in getting stuck in a code. Everyone does. Make that a learning opportunity for yourself and move on. If you are a junior, getting stuck in a code might look like a part of life of a developer. And, YES IT IS.

Good luck and unstuck yourself.

ok-bye.gif

This article was published as the #week2 article for #4articles4weeks.

ย