comic by heeris.id.au

Writing code requires focus. Adding a new feature to an existing system is like writing a new main character into an already finished novel. One small distraction and you may quickly lose your place and spend 5–10 minutes just trying to figure out where you left off.

Here are some tips which I have either used myself or have seen other engineers around me use to get more quality code written.

Pomodoro

The pomodoro method uses timers to help you stay focused on a task. Ususally 25 min of staying focused on a single task followed by a 5 min break. Every four or so completed pomodoros, you can take a longer break.

While a pomodoro session can help you avoid Reddit for 25 min, it can also warn others that you are focused on a given task. I worked with an engineer who would wear a red hat while he was in a pomodoro, this was a sign to hold off on any questions unless it was urgent. It may take a week for your team to learn not to bother you while in pomodoro. If they continue to interrupt your pomodoro, simply remind them that you are in a pomodoro and ask if they are blocked without your help or can wait x minutes.

Team Pomodoro

This is a bit of a twist on the personal pomodoro. Have a permenant pomodoro timer running on a tv where everyone can have a visual. Encourage the team to focus on their own task during this time, leaving any questions or distrations for the breaks. This is difficult to execute! I tried this with a team and while it worked for a day or two, we were not able to keep it consistent enough to warrant keeping the timer up.

Write down where you left off

If you are not finished with a code based task and find yourself needing to run to a meeting or help a co-worker with a different task, write down exactly where you left off / what you were about to do next. When you are able to get back to the task, you will be able to more easily pickup where you left off. You are also less likely to introduce a bug by forgetting any small details which were on your mind before stopping the task.

Block out external sound

Modern work spaces, especially open layout, can be very distracting. From someone on another team screaming about broken unit tests to a stray nerf dart nailing you in the eye. One thing that can be done is to purchase a nice pair of noise canceling headphones. Put on some music which helps you focus and block out all sounds which may distract you. This is especially helpful during a pomodoro session. Here is what I have been listening to lately while coding:

Schedule time on your calendar to code

Especially at larger companies, you may get overwhelmed with meeting after meeting every day, leaving you little time to code. Personally or as a team, it may be a good idea to block off a few straight hours per day to only focus on writing code. A warning, if you find that you must use this method, there may be a larger breakdown in process where most of the day is filled with meetings instead of time to code.

Consolidate team meetings

This requires the coordination of the team. Have meetings which are scheduled back to back. If you must have 4 hours of meetings on a given day, consolidate them into one block. Spreading them throughout the day will basically ensure that almost no code is written. It takes time to start or restart work on a code based task. You want to reduce this time to a minimum since the value comes from writing the code, not trying to figure out where you left off. This leads to the next point.

No meeting day

If your team / company really struggles with meetings and managing time in general, it may help to do a weekly no meeting day. Pick any day of the week and block off everyones calendar for at least half the day.

This reminds me of companies which have free time / innovation time / hackathons. It is highly discouraged to take up developers time with non hack projects during these “free times.” This rule is usually respected and thus the same principle can be applied during no meeting days.

Adjust your work schedule

In most companies where I have worked, the majority of the team would start to trickle in around 9 am and usually leave around 6 pm. If you need some quality focus on code time. Consider adjusting your schedule to show up early or stay later on some days.

A co-worker of mine would arrive at 7 am which allowed him to focus on getting things done without the distrations and interruptions of a normal day. I myself like to get a head start on the day which reduces my overall stress. Arriving 5 min before standup or arriving 2 hours before standup makes a huge difference!

If all else fails, find somewhere else to work

I don’t mean quit your job. I mean leave your desk. While your team may have a million questions for you throughout the day, sometimes you need to work from a lounge area away from your team in order to stay focused and get some work done!

You being the main source of all the answers for a team is a different issue on its own and I will address it in another article.