Develop Better Programming Habits

Abdallah Yashir
4 min readAug 30, 2018
Programming & Photo

As a programmer, we often have the tendency to develop many bad habits because of the ever increasing complexity, communication overhead and constant learning in our jobs. Sometimes, we even sit for hours trying to understand a domain specific issue for example, understanding how TAX works for a particular foreign country’s region. Even trying to learn a new Web Technology or the latest trending Front End framework is demanding. I took a few days to become productive in AngularJS at first. However, I initially found Angular more complicated because I had to also learn ES6, TypeScript and the wealth of different ways to accomplish the same things (FormControl). ReactJS was more straightforward but learning the component life cycle, the use of Redux and fetching data from remote were going to take full mental effort.

I know some software developers who were lean, fit and looked good when they started working. Nonetheless a few months later, their belly fats were the first thing to notice when meeting them. They looked they amassed a few more weight. They looked lethargic. Some depended on coffee to get running. A lack of exercise, bad eating habits but also sitting down too much during the day after all had noticeable consequences.

Nowadays, sitting is the new smoking. Ironically, many of us, move, go outside only to smoke. As programmers, it’s difficult to change our habits. We are almost not aware of them, for example, eating a snacks every now and then while coding or not drinking enough water during the day. By the time we notice it, it’s often too late or painful to change. We delay deciding on doing something to address this situation.

During my time as a professional software developer, I observed colleagues avoided eating in order to lose fats. However, as a side effect, their productivity were also impacted. They also tended to be more easily irritated. I myself tried Intermittent Fasting at work a few times, but had difficulty focusing for long stretches of time in sessions of intense coding. If you want to lose weight, not eating is certainly not the way to go.

“Willpower isn’t just a skill. It’s a muscle, like the muscles in your arms or legs, and it gets tired as it works harder, so there’s less power left over for other things.” — Charles Duhigg

As I completed the bestseller, The Power of Habit by Charles Duhigg, I began noticing bad habits and ways to change them. According to the author, one does not stop a bad habit, rather he or she replaces it with something beneficial. A good friend of mine replaced his smoking habit with drinking soda that he later replaced with succulent fresh fruits juice.

Ideally, if you have the intention of doing the same, start by having a keystone habit. A keystone habit is one that makes changing other habits much easier and manageable on the long term. For instance, exercising in the morning for some people makes them more conscious about the quality of the food they consume, who they socialise with and the amount of sleep they get at night.

“Typically, people who exercise, start eating better and becoming more productive at work. They smoke less and show more patience with colleagues and family. They use their credit cards less frequently and say they feel less stressed. Exercise is a keystone habit that triggers widespread change.” — Charles Duhigg (The Power Of Habit)


To change a bad habit :

  1. Become aware of the habit itself
  2. Decide to change the habit
  3. Believe you can change it
  4. Identify the cue, routine and reward
  5. Identify your brain craving for this particular habit
  6. Replace the routine for something beneficial
  7. Experiment what is best for you

A habit

  1. When I am in the zone programming, I often forget to drink water during the day.
  2. Therefore, I feel dehydrated. I find I cannot keep the same level of productivity and I feel less good. I prefer sustaining my productivity while letting my body be balanced
  3. I don’t like to focus on only one task until I complete it, but not drinking water is harmful
  4. Cue: When in the Zone and feeling thirsty, Routine: I continue working instead of taking a quick break to drink a glass of water or two, Reward: I want to complete the current task while I am still in the zone
  5. My brain does not want to switch context because I feel good upon completing a task. My brain releases dopamine for a reward for the effort I put on doing it.
  6. I can get the same rewards while reducing any context switching by having a bigger glass of water so that I do not need to physically move around which will most probably distract myself particularly if I talk to someone. I then have to put effort again to continue where I was.
  7. I can experiment with several situations as taking frequent breaks is highly recommended for people sitting down and staring at the computer for long hours. By breaking down my assigned task to chunks that are easier to manage, I can then take breaks in between.

“The key to victory was creating the right routines.” — Charles Duhigg



Abdallah Yashir

Senior Software Developer, Writer, Amateur Photographer, Reader