How to combat the feeling of inefficiency in coding?

Sherry Hsu
Aug 27, 2017 · 3 min read

I do work hard. However, sometimes after working for a whole day, I can not easily see the output of the effort. One good example is that I was adding a feature in a code base I was not familiar with. I was able to have a sample solution done in one day and was sure that I could complete the task the next day. It turned out, I had the task completed almost 3 days later…

Yes, there was some missing requirements that I only found out later. Yes, there were hidden bugs that had to be fixed along the way. I had no idea why it took so long to complete the feature. More precisely, I did not know where my time was spent on.

After reading a few time management blogs, I started an experiment.

Analyse the past. (What ate my time?)

  1. Babel Compilation: it may take 10~20sec to compile the code after I saved a change, depending on how fast my laptop was at the time.
  2. Decipher an utility function where it was not obvious how it was derived. It was mainly fuelled by curiosity and my desire to practice more Higher Order Components. Not directly related to the feature work…
  3. Refactoring

How to handle those time eaters?

  1. Babel Compilation Time: I had the habit of saving the file and check the output after making small incremental changes, so hence having to wait for the babel compilation multiple times. To reduce the waiting time, I consciously reduced the compilation frequency by pseudo-coding a piece of work on pen and paper throughly and mentally following the data flow to triple check the flaws in the edge cases before clicking ‘save’.
  2. This is to combat the little monkey in the brain. The monkey in the brain would always tell you ‘just a little more time, you might notice something that is important for the work!’. To quiet the monkey, timebox this investigation phase. Investigate this awesome function in the designated time. Instead of Reading through it and scribbling in margin, actually take a simple example, start from what you know, the desired input and output and slowly refactor it to reproduce the awesome function.
  3. No other way round. Be grateful for the feedback. Judge if the suggestions would make the code more efficient and easier to read. Make changes accordingly. This is where learning happens.

How to let brain know: “Ahh~ I have done so much”

Key: Know how much time is spent on what task.

  1. Pomodoro Technique: I used 15min time frame as a pomodoro. Within the 15min I need to focus only on the task at hand. I would go and get some water after 1 pomodoro, sometimes after 2 or 3 pomodoro depending on how mentally tired I was or whether I was in a flow. Another advantage to this approach was that it reduced my desire to prematurely optimise/refactor the code. “I will just get this part working first, get some water and come back to refactor” This subconscious decision prevented me from detouring many times!
  2. Question guidance: Question is a great way to start the day, get the to-do list ready. It also helps me to focus and find the answer in the 15min. If something does not work as expected, I would ask myself “what makes you think this piece of code to produce that outcome?” and trace the logic backward and examine the flaws.
  3. Record: I recorded the time spent on the mail calendar because I had it open at the time. There are lots of tools available for time tracking and I might use Kanbanflow next time.

Experiment Results

  1. I did feel HAPPIER! This is the key. :) Looking back at the records, I could clearly see where my time was spent on at the end of the day and felt accomplished instead of feeling lost and inefficient!
  2. I felt I was making better decisions consciously by avoid premature optimisation and Timeboxing the investigation. Yes, realising this made me even HAPPIER!
  3. Consistency is the key. I tried this approach for a few days so far and I stopped… (I guess I was happy and felt I have already became efficient…) It is hard to build up good habit. To avoid falling back to old habit and feeling unhappy about the inefficiency again, I should continue trying, adapting. consistently.

)
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade