DEV Community 👩‍💻👨‍💻

Rahul Chowdhury 🕶
Rahul Chowdhury 🕶

Posted on

4 Simple Steps to More Productive Coding Sessions

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

Pomodoro technique
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 pull 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".

Richard from Silicon Valley - 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:

Todoist karma section

Yes, that's about 2,861 tasks that I've completed using the app which earned me about 19K 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 don'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.

Calculating mentally

The best things you can do during a situation like this is to 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 common advice to sleep on your problems.

I remember staying up till 4 AM 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.

Let me know what you think in the comments below. 😎

Top comments (5)

Collapse
 
jschleigher profile image
James Schleigher

Yes, having a to-do list is really helpful. Sometimes I forget to do things, but I have not missed any tasks since I like to keep a to-do list. I like to use quire.io/compare/best-task-managem... to centralize every work. So far, I like Trello and Quire.

Collapse
 
mipot909 profile image
mipot909

To-do lists are great, especially when they're in an app. I tend to lose the paper ones, so apps are better for me. I recommend kanbantool.com for that purpose, it's really great! Easy to use and effective, I like it a lot.

Collapse
 
rohovdmytro profile image
Rohov Dmytro

I am aaaall about Pomodoro. The technique is great. I'm a freelancer so putting limits into my workflow works very good

Collapse
 
rahulchowdhury profile image
Rahul Chowdhury 🕶 • Edited on

Can you tell us a little bit about your workflow?

Collapse
 
rohovdmytro profile image
Rohov Dmytro

Yeah, of course.

I use Google Assistant to set Pomodoros. And an app I wrote to track timers. During a session a use a notepad to track tasks and my goal to be focused is avoiding task switching.

btw, I am currently writing a series of posts about pomodoro.

Become a ModeratorHey! We would love your help!

Fill out this survey and help us moderate our community by becoming a tag moderator here at DEV.