4 Simple Steps to More Productive Coding Sessions
Lessons learnt in 4 years of my coding career
No matter how much you love to code, there always comes a point where you’re at the verge of breaking down because of numerous reasons.
It could be because you’re stuck in a problem for too long or maybe just because you’ve coded for too long without giving your body a well-deserved break.
It’s pretty common in every developer’s life. Been there done that. Pfft.
Fret not, all’s not lost. You just need to make a couple of tweaks to your coding habits and you’ll be back in the driver’s seat in no time.
1. Apply the Pomodoro technique
The fundamental concept of this technique is to work in short bursts and take a well earned short break. Although mostly applied to tasks like writing, this technique fares well for coding too.
Pomodoro technique asks you to:
- Work for 25 mins without disruption
- Then take a quick 5 mins break to refresh your mind
- After that, go back to another distraction-free 25 mins of work
- After 4 sessions, i.e., a little over 1.5 hours of work, take a longer break for 15 mins
Simple, but quite effective. I’ve harnessed this technique for years and all that I can say from my experience is that this just works.
However, I usually take this with a grain of salt. I don’t necessarily put a timer every time I code or write. I usually break my tasks into very small units of work.
When I’m done with that task, I take a quick break.
Let’s see an example, shall we?
Suppose you’re a frontend developer, using React to create a web app. You can break this task into the following workflow:
- Write a component
- Take a quick break
- Write tests for the new component
- Take a quick break
- Move on to the next component
This way you’re not forced to leave your work in the middle just because you’ve crossed your 25 mins time limit.
2. Kick out the distractions with some chill beats
This has got to be the №1 factor in me getting stuff done. Doesn’t matter whether you’re working in an office or alone at your home, distractions are everywhere.
Sometimes it’s your phone buzzing and other times it’s someone dropping by your desk to say “Hi”.
These are the kind of distractions that pulls you out of your flow. Once that’s lost, it’s hard to get back into the context and the deep state of mind you were already in.
As Cal Newport, in his book Deep Work rightly says:
“If you service low-impact activities, therefore, you’re taking away time you could be spending on higher-impact activities. It’s a zero-sum game.”
When you say yes to activities of low impact such as checking your Facebook notification or engaging in a water cooler talk, you’re missing out the time to engage yourself in activities that improve you and help you progress in your career.
Coding requires attention. Coding demands a deep state of mind. A distracted mind will rob you of your ability to make the most out of your coding sessions.
Now, the question is how can you avoid these petty distractions in a world full of distractions.
The simplest answer to that can be to:
- Put on a pair of headphones
- Play some good music
- Resist the urge to respond to whatever’s going on around you
A common term for this kind of activity is “being wired in”.
I love being wired in. That’s how I get most of my work done. When I’m wired in, people around me have a hard time getting my attention.
I remember once someone from my team sent me messages on all channels, Slack, Hangouts, SMS, Email and what not and then still had to physically wave their hand in front of me to grab my attention.
That is the kind of focus I’m talking about here.
Listening to music isn’t a requirement here. It helps to isolate yourself in a very noisy environment. However, if you’re cool with not putting on a pair of headphones and achieving the kind of focus I’m talking about, then sure, don’t.
Just do whatever you need to develop a deep state of mind when you’re working. This is the time when you do all sorts of magic and create wonderful stuff.
3. Have a to-do list
I’ve struggled with having a to-do list for long. Mainly because adding to-do items to my list every single day seemed like a chore itself.
After reading numerous articles praising the habit of having a to-do list and trying out maybe every popular to-do app out there, I finally settled on maintaining a to-do list using Todoist.
This is by far the most intuitive to-do app that I’ve used. This app makes adding to-do items a breeze. Maybe that’s the reason I was able to stick to this habit for quite some time now.
Here’s a quick overview of my stats on Todoist:
Yes, that’s about 2,082 tasks that I’ve completed using the app which earned me about 15K in karma points.
In case you’ve already started wondering, this is not an ad for Todoist. I’m only praising this app because it has genuinely helped me in establishing the habit of keeping and following a to-do list.
The main reason behind having a to-do list is that once you have your list of tasks for the day ready, you are not left to wonder what you need to do next. It’s all there, sorted by priority.
Just follow the list and get things done. Period.
How to maintain a to-do list without breaking your head:
- List out your tasks for the next day before you go to sleep at night
- Break your tasks down into very small tasks that doesn’t take too long to finish
- Sort your tasks by priority (p1 for immediate and important tasks, p3 for non-important chores)
- Follow this habit every single day without fail
The first few days will be hard. You’ll resist. You’ll miss. Just keep on going. Once you get in the habit, it’ll become second nature.
As of now, I don’t even need to remember to maintain my to-do list, it’s a routine to me. Every night, I list out all the things that I need to do for the next day and follow them throughout the day.
Pro Tip: You can try out Todoist Premium for 2 months by using my referral code here.
4. Revisit problems later
It’s a no brainer that we spend too much of our time fretting on problems that we’re stuck on due to some petty mistake.
Sometimes, it’s too hard to find that one mistake you’re making because your brain is clogged up with useless information. We spend hours only to find out that we’re back to square one.
The best things you can do during a situation like this is abandon the problem for some time and focus your mind on some other task. It can be some other coding problem or maybe not related to coding at all.
Revisit the original problem at a later time. Best, after a good night’s sleep. Your subconscious mind is a treasure chest of unknown mysteries. It’s capable of solving problems that your conscious mind is unable to.
“Know that in your deeper mind are Infinite Intelligence and Infinite Power.” — Joseph Murphy
Give it the time and the opportunity to solve your problems. That’s why it’s a common advice to sleep on your problems.
I remember staying up till 4AM in the morning being stuck on a coding problem where I wasn’t able to get XML and Retrofit to work properly. It was only after I went to sleep that night that I was able to solve the problem in the morning right after I woke up.
I had that eureka moment, all of a sudden.
And that’s all folks, we’ve reached the end of this list. A last piece of advice for you, don’t try to master all of these steps at once. You’ll feel swamped and that’ll be counterproductive.
Just take one step at a time, master it and move on to the next one.
If you’ve liked this story, please 👏🏻 👏🏻 👏🏻 to show some love and spread the word around. Follow me for more stories like this.
This blog was written by Rahul —
the Android guy at Mitter.io who took the whole messaging thing a bit too seriously and now refuses to communicate using speech. You’ll find him at his desk, calmly typing out code, or his next message.
Follow our blog for more stories from the Mitter.io team, and their quest to find the right tools and the best solutions for all things dev.