Today I’d like to talk about a quality that’s essential to success as a computer programmer. Let’s call it “comfort with discomfort.” As programmers, we live in this unsettling space. Here are some thoughts on discomfort and tips for dealing with it skillfully.
Example: Grow Cube
When I first started programming, I took a computer science course that presented a puzzle called the “Grow Cube.” You can play it online here:
This puzzle starts with a 3D cube world and some buttons, and pressing those buttons initiates actions on the cube: water fills a pool, a character walks around. Initiating these actions in a precise order solves the puzzle, rewarding you after each step correct with a series of escalating animations.
Solving the puzzle requires some brute force. You have to try something, pay attention, and then try again.
Bugs Are Uncomfortable
There’s something uncomfortable about facing a bug in computer programming. A bug is a disconnect between how we think something should work and how it does work. That is inherently uncomfortable.
And some bugs can’t be solved quickly. I’ve faced bugs that took me a few minutes to solve, and others that took me and a pair-programming colleague an hour, or a whole day. In production software, bugs that elude solutions for weeks are common. The discomfort can last for a while.
Some bugs resist reproduction– the famous “Heisenbug.” Named after German physicist Werner Heisenberg, Heisenberg’s Uncertainty Principle states that there is inherent uncertainty in the measurement of a particle. The term “Heisenbug” has been extended to cover bugs that resist inspection. When you set up all the conditions for the bug, it vanishes, but when you’re messing around in your development environment, or demoing your software on a crucial sales call, it appears. This inability to reproduce the bug when it matters is a special discomfort.
When I started programming, I found this discomfort excruciating. I wanted it to be over, so I looked for shortcuts that would get me there. The discomfort makes it hard to think, which is essential to successful debugging.
And so, I think one of the most important skills that you can have in programming is the ability to experience, and maybe even enjoy, the discomfort. This shows itself best in debugging, but it’s part of all the work we do. Some of the best programmers that I’ve worked with have an inhuman ability to, in the face of a daunting obstacle, stop and say: “This is an interesting bug!” Or: “Wow, I didn’t expect that to happen!” Somehow, they can wade into the problem with a positive attitude and a set of good questions brewing.
Something I’ve experienced after gaining expertise in my domain is that bugs I can’t solve right away are pretty much always interesting to me. I enjoy the novelty of being stuck— for a while.
Tips to Get Comfortable With Discomfort
How can you get to this place when you’re new and everything is hard? I have a couple of suggestions.
First, since you can’t remove the discomfort, get physically comfortable. Fix your hardware: get a nice monitor, mouse, and keyboard. Get a good chair or standing desk and a good posture. Get some decent lighting and put on music or headphones. Make yourself something to drink. You can’t eliminate the discomfort, but you can optimize your physical comfort.
Second, find a way to slow down what you’re seeing. Narrate your progress out loud. Start learning to make predictions rather than clicking and reacting. Take notes, and cross out things that you’ve determined with high confidence are not causing the bug.
Third, embrace the situation. Difficult work is an unavoidable part of being a programmer. It’s why programming is such a valuable skill set. This never goes away; when you start to get good, you graduate to tougher problems.
Metaphor: Learning an Instrument is Uncomfortable
A team I worked with, all engineers, had many who were also musicians, and I think this ties into this idea. When you first start learning an instrument, it’s uncomfortable.
To take the acoustic guitar as an example, it’s painful to hold down steel strings even for a few seconds. Getting your left and right hands to coordinate is unnatural. Hitting one string and not the other five takes practice.
To get through this discomfort, you have to spend time alone in your room overcoming many obstacles. And once you do, you graduate to harder pieces of music, expression, and musicianship. You don’t escape the discomfort; you learn to enjoy it.
I feel a kinship with musicians, as I do with programmers. The discomfort is similar.
Conclusion
To conclude: discomfort is part of this work. It never completely goes away, and it’s the reason programming is such a valuable skill. We can learn to manage it.
And now, it’s time for me to do some debugging.