seascape models

Stay motivated with R programming by knowing your emotions

We don’t usually think of programming as an ‘emotional’ experience. It is all code and computer logic and if using R, probably statistics.

We often think of programmers as emotionless human-machines, who, powered by coffee, program late into the night, far removed from any subjective feelings.

But most of us aren’t like this. Programming can be intensely emotional - I often confront these emotions when teaching R courses, especially when teaching newcomers.

Recognising the emotions you face when programming can actually help you be a more productive coder. Here’s how.

Emotions associated with learning to program

Some common feelings new users report are:

All of these emotions, whether you see them as ‘positive’ or ‘negative’ can actually motivate or demotivate us. Let me give two examples.

Elation is commonly described as a ‘positive’ emotion, which is usually associated with cracking a difficult programming problem. For instance, maybe you just got your linear regression model to work and the results look really interesting.

Elation can motivate you to keep trying new things, because it is rewarding. It can also be demotivating. If you have prematurally declared a problem solved, the feeling of elation may mean you miss a mistake, or a better solution.

Frustration is probably the most common feeling I hear about (as a teacher of R). Frustration can be demotivating - “I just can’t fix this!”. Or it can be motivating - “I need to get this fixed and I’m not getting up until I do”. In fact for me, frustration is often a driving force behind solving difficult coding problems. Frustration motivates me to keep trying until its solved.

Benefits of being self-aware

Being self-aware of how you feel can help you be a more productive programmer.

Say you are elated about getting an analysis coded. But knowing you are perhaps over-excited, you stop yourself before you send the results straight to your supervisor. You realise you need to double check that the data were entered correctly and that the model fits the data appropriately before you can be confident in sharing your conclusions.

Frustration as a motivating force can also be a trap. It is helpful to realise when frustration is driving you too hard to try and solve a problem.

Often you will find that the solution ‘just comes to you’, as soon as you step away from the computer, perhaps to take a stroll.

Frustration can also lead you into a pointless dogfight with small bugs, causing you to lose sight of the bigger picture. A good example is the Folk Theorem of Statistical computing:

“When you have computational problems, often there’s a problem with your model” Andrew Gelman

I have often run across this issue when I am trying to fit standard models (e.g. GLMs) to new types of data. Often the solution lies in the bigger picture - the need for a new type of model.

The emotional cycle of programming R

As you learn to program it is also worth taking note of how your emotions change over time.

A typical sequence of feelings when learning a new technique in R (e.g. a new package) looks like:

  1. Intrigue, when you discover an interesting new technique you think will be useful.
  2. Frustration as you try to make the method work with your data.
  3. Satisfaction when you get the method to work.
  4. Boredom once you have mastered the method, but still need to tidy up the small details.

Knowing where you fall on this cycle can help you overcome the pitfuls of each step and keep motivated.

Emotionally intelligent programmers

Someone recently asked via twitter what is your best advice was for a newbie to learn programming?.

Most of the responses related to learning materials, or the technical aspects of programming. However, at a deeper level, learning to programming means finding ways to keep yourself motivated enough to keep trying. So I think, before we consider technical advice, we need to think about what will keep people going.

So here is the tweet-worth of advice I posted:

Learning to code is emotional- frustration, joy, boredom… Find yourself a support network of like minded coders to keep motivated

Having other people who can help you is great, not only because you can pool thoughts to solve problems, but because they can be empathetic to your challenges. Sometimes having some understanding is all you need to keep going and solve a coding problem.

I will end this post on piece of advice posted by the person (Brian P. Hogan) that asked the question above, I think its telling:

“Software dev is 20% code and 80% people. Level up communication skills and show love to everyone.” Brian P. Hogan

So remember, computer code might be emotionless, but you shouldn’t expect yourself to be.

Contact: Chris Brown

Email Tweets YouTube Code on Github


Designed by Chris Brown. Source on Github