Comfort With Discomfort
- 4 minutes read - 755 wordsToday I’d like to talk about a quality that’s essential to success as a computer programmer. Let’s call it “comfort with discomfort.”
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 and some buttons, and pressing those buttons initiates actions on the cube: water fills a pool, a character walks around. Initiating these actions in the correct order solves the puzzle, rewarding you after each step with a series of escalating animations.
The solution requires an element of brute force. You have to experiment, see what happens, and then start over, again and again.
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. And that’s uncomfortable.
And some bugs don’t get 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 just 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 the only good tool in a debugger’s arsenal. If you can’t sit, collect information, catalog it, and use it to make a theory about what’s happening, you’re not going to get very far in a debugging session.
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!” Wading 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 (for a while).
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 record 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. Just when you start to get good, you graduate to tougher problems.
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 just a few minutes. Getting your left and right hand to coordinate, even somewhat, is unnatural. Hitting one string and not the other five can feel like threading a needle.
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.
And now, it’s time for me to do some debugging.