Home > Psychology of Engineering > Emotional Coding

Emotional Coding

The “five stages of grief” is an oft-referenced model of human behavior when faced with a significant loss. As programmers, we face losses and resolute adversities on daily basis, from bugs that simply refuse to be revealed, to horrible software, and missed deadlines. Having worked as a software engineer for the past 6 years, no doubt I have experienced the five stages of grief in my work, as have so many others. But I have also noticed other predictable progressions in the mental and emotional states of myself and my fellow software engineers (No, we don’t cry all the time… unless we are testing against IE). It’s interesting to consider how we come by our mental states and how they affect the quality of the software we produce. Happier coders code more better right?

Of course there are innumerable external factors that influence how we feel and behave on a daily basis, but taking a step back it’s not hard to see patterns. It seems to me that software developer mental states are highly correlated with the state of the system they work within. This includes the state of the company (whether it’s profitable), the state of the products (under design, development, or maintenance), the upcoming software release, family life, the weather, if there were enough donuts for breakfast, and so on.

First of all, there’s a natural progression for software projects. First venturing into the unknown, working with new technologies, learning, and making new discoveries. If you’re lucky and the project wasn’t already behind by the time it was started, this is a really fun time. Optimism reigns. If you hadn’t already, your team soon picks a direction. Momentum builds after a few weeks as do doubts in some of the original choices. Internal or customer demos approach and tensions grow. Things should work, but hey this is software, and something always goes wrong before (or during) a demo. But as usual, the team makes it through, so the heads go back down and the hacking resumes. A momentous day arrives – customer order numero uno! Your hopes grow that this whole endeavor hasn’t been a complete waste of time. But orders mean deliveries which means more testing and good grief are you’ve never seen so many bugs. A frenzy of activity, long work days bleeding into the weekends, then boom! It’s done, delivered, shipped. Let out a little steam, have a beer, and relax for what seems like 15 minutes before resuming the software development rat race.

Feel free to adapt the above to a spiral software development model if that suits you better.

But what level of detail are we focusing on? Progressions are happening at every level, each with its own set of ups and downs.

At a high level, consider your overall job happiness. Maybe things were great at first but now you’ve been doing the same thing for what seems like forever and you’d give anything to switch to another project. Hell, you’d even volunteer to work on the test framework or that ridiculous proposal to write your own database rather than use a real one. Anything to change it up!

Zooming in to the next level, you can see there’s a progression attached to the products you make. If your company is anything like mine, you might see major new products being developed then released every few years. If you’re lucky, there are times of discovery, hard work, perseverance, and celebration when the product starts raking in the dough. On the other hand, most of us have seen products go belly up, with the team left downtrodden or disbanded.

Next, I’d say there’s the software release progression, which is often tightly defined. Planning, coding, testing, release. We all are familiar with the moods throughout that cycle.

As my blood pressure reaches dangerously high levels thanks to IE 9, I am ready to reconsider my commitment to this profession…

But, perhaps most importantly, what are the predictable states I find myself in? A programmer’s effectiveness is tightly coupled to his or her state of mind. Software systems reflect the structure of the companies that design and build them (Conway’s Law). Likewise, code reflects the workings of the mind that conceives it. To what degree does our state of mind affect the code we produce, the designs we draw, and the clarity of the interfaces we formulate?

If you’re not on your game, if your family life is a mess, or if you’re distracted by pictures of cats, how much more likely are you to forget to convert units in that equation you’re working on? It’s interesting in software engineering how decisions or omissions at key points in time can have such dramatic consequences down the road.

Why oh why did we decide to split the records across two databases???

Maybe the team leader just made a hasty decision because he was uncomfortably full from that breakfast burrito.

On the other hand, mistakes can be made when you’re feeling good too. Presumably self-confidence of individuals or the team is involved with the Second-System Effect.

As a programmer that now works remotely, I have the distinct pleasure of hearing my own internal monologue mostly interrupted throughout the day. I’m distinctly more “in touch” with my own mental state now as compared to when in the office surrounded by activity and other people. I’m equally free to curse loudly when intermittent bugs refuse to be found and to jump and hoot when I finally get asynchronous speech recognition notifications to the python actors working.

Being in touch with the emotions of yourself and of your teammates makes you a better engineer. If you’re at the end of your wits, take a break if you can. If the QA folks are going insane because 3 software releases are going on in parallel, plan better for the future. If your team needs to blow off some steam, buy a pool table and ping pong table for the office like us. If you’re bored off your ass browsing the internet all day, are you sure you’re at the right company?

We should all strive to be happier coders. A little introspection can go a long way.

  1. March 7, 2013 at 4:28 AM

    nice edge, there’s much too little focus on emotions and non-analytical qualities in our business. i almost cried … 😉

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: