Printed on demandShips worldwide14-day returns

Debugging Is Like Being the Detective in a Crime Movie: Origin and Meaning

“Debugging is like being the detective in a crime movie where you are also the murderer” means that when you hunt a bug in your own code, you are investigating a crime you committed. You follow the clues, interview the suspects and, in the last scene, find your own name in the commit history.

The line comes from a tweet by programmer Filipe Fortes (@fortes), posted on 10 November 2013 (UTC; 9 November in US time zones). The tweet is still online.

Who said it, and how we know

The quote travels the internet without a name more often than with one. Fortes wrote about that himself in a 2017 blog post, One Good Tweet. He explains that he wrote it in autumn 2013 while fixing a bug in his own code, that his timeline “started to blow up” within hours, and that most copies dropped his username.

Two corrections you will need if you quote it:

  • The name is Filipe, not “Felipe”. The misspelling is common.
  • The source is a tweet from 2013. Some blogs claim an older blog post as the origin, but we found no dated evidence for that, and one of them admits it could not trace the claim.

Why it is funny for developers

Because it is true. Most bugs are not caused by cosmic rays or the compiler. They are caused by code someone on the team wrote, and the most likely someone is you. The detective story has the classic twist ending, and every developer has lived it.

There is even a command for the final reveal. git blame shows who last changed each line of a file:

$ git blame -L 40,44 src/checkout.py

You run it to find the culprit. The output shows your name, and a date from three weeks ago when you were “just making a quick fix”. Case closed.

Debugging, done like a detective

The metaphor is also good advice. Detectives do not guess; they collect evidence and test theories. A solid debugging session looks the same:

Detective workDebugging equivalent
Visit the crime sceneReproduce the bug reliably, with the smallest input that triggers it
Collect evidenceRead the full error, the stack trace and the logs
Build a timelineFind the last version that worked
Narrow the suspectsCut the search space in half, again and again
Explain the case out loudTalk it through, even to a rubber duck

Git automates the timeline step. git bisect runs a binary search over your history. You mark the current commit as bad and an old release as good. Git checks out the midpoint, you test it and answer good or bad, and it repeats until it names the commit that introduced the bug.

$ git bisect start
$ git bisect bad
$ git bisect good v2.3.0
$ git bisect good
$ git bisect bad
$ git bisect reset

The last step, explaining the case out loud, has its own name. We cover it in rubber duck debugging. And when the bug disappears before you understand it, you are in “it works, why?” territory, which is a different genre of film.

A short history of the word “bug”

The detective joke is new; the word is old. A popular story places the first computer bug on 9 September 1947, when operators of the Harvard Mark II found a moth in a relay and taped it into the logbook with the note “first actual case of bug being found”. The word “actual” is the giveaway: engineers already called faults “bugs”, and Thomas Edison used the term in the 1870s. The Centre for Computing History keeps a record of the logbook entry.

Grace Hopper often told the story and made it famous, but sources disagree on whether she was in the room when the moth was found. The moth, at least, was innocent. It was the victim, not the murderer.

Get the shirt

Our Debugging Definition shirt prints the idea as a dictionary entry. It fits anyone who has spent an afternoon chasing a bug and found the answer in their own commit. Pair it with the duck, the best witness in any investigation.

Debugging Definition T-Shirt, front

Debugging Definition T-Shirt · 24 €
The dictionary definition of every debugging session.

Quack the Code Rubber Duck T-Shirt, front

Quack the Code Rubber Duck T-Shirt · 24 €
The witness who solves the case without saying a word.

It Works, Why? Developer T-Shirt, front

It Works, Why? Developer T-Shirt · 24 €
For the bug that vanished before you found it.

All shirts are unisex, S to 5XL, printed on demand. Check the size guide. More in our developer t-shirts, and gift ideas in the Christmas gift guide for programmers.

FAQ

Who said “debugging is like being the detective in a crime movie where you are also the murderer”?

Filipe Fortes, in a tweet from his @fortes account dated 10 November 2013 (UTC). He confirmed the story in a 2017 post on his website.

Is it Filipe or Felipe Fortes?

Filipe. “Felipe” is a frequent misspelling in quote collections.

Is there a real technique behind the joke?

Yes. Reproduce, collect evidence, narrow the search with tools like git bisect, and explain the problem out loud. That is detective work.