There are times while you are coding that everything suddenly feels like it is going right, you are in the 'zone' for want of a better word. You are being productive, making progress, and generally feeling like a badass, ninja coder. However for every moment you spend in this zen like state, a hundred more will arise when you are stumped. You reach a point where you feel as though you have hit a brick wall. Suddenly your productivity takes a sharp turn for the worse as you encounter a problem that is simply outwitting you. Now the default reaction to this is to stare unerringly at your monitor for the next two hours making little to no progress as you rack your brain for a solution. My friend, I have an antidote that has helped me in these situations, time and time again; Take a break.
This might at first sound like a daft idea, 'How can you be solving the problem if you aren't looking at it?' Well my friend that is exactly the point, you want to separate yourself from the problem to give your brain time to properly digest all the information. I remember hearing this advice for the first time when I was younger from an excellent lecturer called Rob Miles, who among other things championed this method of working.
If you hit a problem that you really can't seem to solve, take a step back and give your brain a chance to breath. Go and make a cup of coffee, get some fresh air, or do something you find relaxing like playing some music or reading a book. Give yourself a rest in the range of 15 to 30 minutes and then return to your code. I guarantee you will see something you didn't see before, something will have clicked in the old grey matter that had just needed time to process. Sometimes the solution may jump off the page at you, other times you may being experimenting with things you hadn't thought of before, but you will return with fresh eyes, and a fresh perspective. It's like the old saying 'Can't see the forest for the trees'.
Trust me, it really works, and it can help no end when you feel stress building up around a particular problem. Another good idea when you are working on larger projects is to work on another part of the code for a while and come back to the part giving you difficulty, often something might have changed to give you a new idea of how to tackle the problem. If it's late too you're better off getting an early night and waking up early to tackle the problem, most bugs are introduced late at night when you aren't thinking perhaps as well as you would be at ten in the morning!
Now I am not advocating procrastination, these problem will require work and attention, but often these short breaks can prove invaluable in helping you while you code.
Time to go and put the kettle on I feel
No comments:
Post a Comment