All of a sudden there is so much confusion because Jack's code is not working properly and he can hardly figure out why. He looks at his many lines of code over and over again and he thinks in exasperation 'Everything is fine, so where's the error coming from?'.
You might be familiar with the feelings described above if you are a programmer because everybody experiences it when nothing seems to be working. I even find myself hitting things some times. How do you deal with this feeling?
The first thing you should do if nothing is working is to stop because going further will lead to no progress at all and most probably messing up your own code. So just close the lid and do any of the following:
This will go a long way in helping you increase your imagination, creativity, tolerance and patience which are great things that can help you regain focus. Most times this works magic in getting you to figure out what is wrong with your code.
Listen to good music, music that you love, music that can even make you forget for a few minutes that you have been coding. This can help you look at your code from a whole new perspective and fix bugs like magic.
Taking a walk can really lighten your mood and if you program, you know the difference your mood can make. It can be the difference between writing smooth running code and smashing things. Just take a quick walk and see if you can solve your problem.
Sleep will help you reduce stress, improve your memory and put you in a better mood. If you take a nap and get back you focus, that can help you write better code.
Get into a discussion that isn't even related to programming. Just a chitchat. Could be online or with someone physically as it will be a great help.
Do something recreational that you love. You could see a movie, play football, play a game or something else as that will go a long way towards helping you.
If nothing seems to work, get help. Get someone else to look at your code. I've seen situations where someone else pinpoints the problem with a simple glance.