paint-brush
It’s not a bug, it’s a puzzleby@shlominissan
404 reads
404 reads

It’s not a bug, it’s a puzzle

by Shlomi NissanOctober 13th, 2017
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

When I was learning how to code I got stuck all the time. I didn’t know why I was stuck but getting unstuck was a lot of fun. I would retrace my steps and investigate every line of code that may have caused my program to crash. It was like trying to solve a puzzle.

Company Mentioned

Mention Thumbnail
featured image - It’s not a bug, it’s a puzzle
Shlomi Nissan HackerNoon profile picture

When I was learning how to code I got stuck all the time. I didn’t know why I was stuck but getting unstuck was a lot of fun. I would retrace my steps and investigate every line of code that may have caused my program to crash. It was like trying to solve a puzzle.

The seemingly unsolvable problems thrilled me the most and I always found the energy to confront them. This is what got me hooked on programming.

This was a long time ago… I’ve been a professional software engineer for over 12 years now and getting stuck, or finding a bug as I refer to it these days, has become the bane of my existence.

The origin of the word bug as it pertains to engineering goes all the way back to 1947 when Dr. Grace Hopper discovered a moth stuck in one of the relays of the Mark II computer. When asked why the machine was not operating as expected she explained there was a “bug in the system”.

Today, the word bug carries a lot of weight. Simply uttering it — especially on a Friday afternoon — will immediately turn a smiling engineer into a frowning one.

I don’t know how it feels to open up a gigantic computer and examine the relays for dead insects, but if I had to describe the feeling I get confronted with a new bug, this analogy will serve well.

The source of my pain was never the problem itself but what it could signify in a fast-paced development cycle: missing the schedule; letting my team down; disappointing my users.

Those early days puzzles were fun because I was building things for myself but now I had to worry about the pressure of the everyman work life.

It never occurred to me it didn’t have to be this way.

I recently finished reading The Pragmatic Programmer by Andrew Hunt and David Thomas and I can’t praise it enough. One of the many topics covered in their book is the mindset of debugging.

Here’s what they had to say about it:

Debugging itself is a sensitive, emotional subject for many developers. Instead of attacking it as a puzzle to be solved, you may encounter denial, finger pointing, lame excuses, or just plain apathy… It’s easy to get into a panic, especially if you are facing a deadline, or have a nervous boss breathing down your neck while you are trying to find the cause of the bug. But it’s very important to step back a pace.

This paragraph inspired me to try something new. A couple of weeks ago I scribbled the word PUZZLE on a sticky note and taped it to my monitor. I wanted to remind myself to treat the next bug like an exciting new challenge instead of an urgent catastrophe.

In 1988, Dr. Dweck first presented a research-based model to show the impact of mindsets. She showed how a person’s mindset sets the stage for their performance.

Approaching problems with curiosity — what Dr. Dweck described as the growth-mindset approach — showed a significant increase in the desire to learn, embrace challenges and persist when facing setbacks.

Ahh, the power of the mind… As foolishly as it may sound, choosing to approach bugs with a different mindset changed my entire outlook. It felt more like the good old days and less like doomsday.

It makes sense that approaching problems with playfulness instead of anxiety will improve your ability to solve them but what I learned is that it’s possible for us to choose it. We just need a simple reminder.

If you feel anxiety building up when your program starts crashing, you should try this approach for yourself. Approaching bugs as if they were puzzles will make the process of solving them more enjoyable; it will help you become more efficient, and it will make the solution much more rewarding. It might even remind you what got you excited about writing code in the first place.