This is the second part of the ninth article from the series "Tips from The Clean Coder". Here we gathered and summarized the main tips from the ninth chapter.
Focus is a scarce resource, rather like manna. After you have expended your focus-manna, you have to recharge by doing unfocused activities for an hour or more.
Professional developers learn to manage their time to take advantage of their focus-manna is high; and we do other, less productive things when it's not.
Focus-manna is also a decaying resource. If you don't use it when it's there, you are likely to lose it. That's one of the reasons that meetings can be so devastating. If you spend all your focus-manna in a meeting you won't have any left for coding.
Worry and distractions also consume focus-manna.
Professional developers manage their sleep schedule to ensure that they have topped up their focus-manna by the time they get to work in the morning.
There's no doubt that some of us can make more efficient use of our focus-manna by consuming moderate amounts of caffeine. But take care. Caffeine also puts a strange "jitter" on your focus. Too much of it can send your focus off in very strange directions.
Focus-manna can be partially recharged by de-focusing. A good long walk, a conversation with friends, a time of just looking out a window can all help to pump the focus-manna back up.
I have found once the manna is gone, you can't force the focus. You can still write code, but you'll almost certainly have to rewrite it the next day or live with a rotting mss for weeks or months.
There's something peculiar about doing physical disciplines such as martial arts, tai-chi, or yoga. Even though these activities require significant focus, it is a different kind of focus from coding. It's not intellectual, it's muscle. And somehow muscle focus helps to recharge mental focus. It's more than a simple recharge though.
Another thing I find essential for focus is to balance my output with appropriate input. Writing software is a creative exercise. I find that I am most creative when I am exposed to other people's creativity. So I read lots of science fiction.
One very effective way I've used to manage my time and focus is to use the well-known Pomodoro Technique, otherwise knows as tomatoes.
You set a standard kitchen timer for 25 minutes. While that timer is running, you let nothing interfere with what you are doing. If the phone rings you answer and politely ask if you can call back within 25 minutes. If someone stops in to ask you a question you politely ask if you can get back to them within 25 minutes.
When the tomato timer dings, you stop what you are doing immediately. You deal with any interruptions that occurred during the tomato. Then you take a break of 5 minutes or so. Then you set the timer for another 25 minutes and start the next tomato. Every fourth tomato you take a longer break of 30 minutes or so.
On a good day, you might get 12 or even 14 tomatoes done. On a bad day, you might only get 2 or 3 done.
Sometimes your heart just isn't in your work. It may be that the thing that needs doing is scary or uncomfortable or boring.
Whatever the reason, you find ways to avoid doing the real work. You convince yourself that something else is more urgent, and you do that instead. This is called priority inversion.
They are a little lie we tell ourselves. We can't face what needs to be done, so we convince ourselves that another task is more important.
Actually we aren't lying to ourselves. We are building a defense to protect us from the judgment of others.
Clearly this is unprofessional behavior. Professionals evaluate the priority of each task, disregarding their personal fears and desires, and execute those tasks in priority order.
Sometimes you will make a decision and wander down a technical pathway that leads to nowhere. The most vested you are in your decision, the longer you'll wander in the wilderness. If you've staked your professional reputation, you'll wander forever.
Prudence and experience will help you avoid certain blind alleys, but you'll never avoid them. So the real skill you need is to quickly realize when you are in one and have the courage to back out. This is sometimes called The Rule of Holes: When you are in one, stop digging.
Messes slow you down, but don't stop you. They are worse than blind alleys because you can always see the way forward, and it always looks shorter than the way back (but it isn't).
Nothing has a more profound or long-lasting negative effect on the productivity of a software team than a mess. Nothing.
Experience and prudence can help you to avoid them, but eventually, you will make a decision that leads to a mess. Going back looks expensive because you'll have to rework the existing code, but going back will never be easier than it is now.
Moving forward through a swamp, when you know it's a swamp, is the worst kind of priority inversion. By moving forward you are lying to yourself, to your team, to your company, and to your company.
Software professionals are diligent in the management of their time and their focus. They understand the temptations of priority inversion and fight it as a matter of honor. And they are always on the lookout for growing messes, and they clean them as soon as they are recognized.