- Published on
Debugging Notes a la Mystery Novella
- Authors
- Name
- Linell Bonnette
Iâve always been a huge proponent of taking really good notes on what I do in a day. I think that daily note taking, and journaling in general, is one of the most impactful practices in my life. It gives me an easy way to look back through what I was thinking about, what I thought about it, and a way to track new things going forward. Iâve changed up my methodology over the years, but I stand firmly by writing a bunch of words throughout my day being just crazy useful.
One of the most useful types of note taking I do is when Iâm debugging an issue. It can work well in other areas, but itâs a lot of fun when youâre fixing a bug. The whole trick is to treat the process thing like youâre writing a story. I specifically like to imagine that itâs a sort of mystery novel where Iâm the detective tracking down something unknown. It gives you a structured game plan for debugging, it forces you to think through all of the bugâs implications, and it gives you a great piece of documentation at the end. Ideally, someone reading your document will be able to completely understand the bug and would be able to debug it themselves if it came up again. Iâll outline more specifically what I do, but really thatâs the whole idea.
My method is simple:
- Create a document with headings for each of the five elements of a story.
- Exposition - what is the bug? How did you notice it? When? Is something behaving differently than expected? Ideally, everything you know about this bug when you first sit down to debug it makes its way into this section.
- Rising Action - is where you start the real debugging. The Author Learning Center says that rising action ânormally begins with an inciting incident, or a moment that sets your story into action. As it progresses, youâll have multiple moments of conflict that escalate and create tension as the story moves toward the climax.â This is where youâll record the twists and turns of actually figuring out whatâs going on. A good sign that youâve completed the rising action section is that youâve finished writing a failing test case that, once fixed, means youâve resolved the bug.
- Climax - is where everything changes from âwhatâs going onâ to âletâs fix it.â This is when you can definitively say that you have tracked the issue down and know how itâs failing. I like to treat the climax as me actually fixing the bug. Weâre writing code, weâre running tests, weâre documenting what does and what doesnât work. This is your chance to record the decisions youâre making and why youâre making them. At the end of this section, your test case is passing.
- Falling Action - is where you stop and assess the fix itself. In this phase, weâre going to make sure weâve thought about any second-order consequences that either the bug itself or your fix will cause. Write out anything else that might be needed for the bug to be fully fixed. For example, many bugs at SBLive will have affected dozens of games before weâve found and fixed it, and in those cases I typically also need to write a rake task that can be run to programmatically fix those previously affected games.
- Conclusion - is where you wrap everything up. The whole document youâve created is really just a living incident post-mortem, but the conclusion section is useful for recapping how everything actually ended up turning out. Imagine that this is the only section that most people read.
- I usually also have a separate âQuestionsâ section in which I just keep a running list of questions I come up with during debugging. This section is useful when it feels like Iâve hit a dead end or when I feel like Iâm missing a link somewhere in the chain.
- Starting with the exposition, start filling in each element with the pertinent information about your bug.
- Once youâve fixed the bug, go back and flesh out the sections to fix any typos and add any new findings that you now know were relevant. I try to keep this step pretty minimal â part of the point of the process is that the reader learns everything along with you â but itâs important to help take it from ârough notesâ to âfun story.â