A Scientific Approach to Debugging

This list, taken from John Regehr’s How to Debug (via), aligns nicely with my process for debugging software.

  1. Verify the Bug and Determine Correct Behaviour.
  2. Stabilize, Isolate, and [Reproduce].
  3. Estimate [Likelihood of Probable Causes].
  4. Devise and Run an Experiment.
  5. Iterate Until the Bug is Found.
  6. Fix the Bug and Verify the Fix.
  7. Undo [Unwanted] Changes.
  8. Create a Regression Test.
  9. Find the Bug’s Friends and Relatives.

My changes/clarifications are shown within square braces. Trust me, read the full post. Each step is explained in detail.

I’ve just finished re-reading Robert Pirsig’s Zen and the Art of Motorcycle Maintenance, where a similar debugging approach (the scientific method) is explained.

“For this you keep a lab notebook. Everything gets written down, formally, so that you know at all times where you are, where you’ve been, where you’re going and where you want to get. […] Sometimes just the act of writing down the problems straightens out your head as to what they really are.

The logical statements entered into the notebook are broken down into six categories:

  1. Statement of the problem.
  2. Hypotheses as to the cause of the problem.
  3. Experiments designed to test each hypothesis.
  4. Predicted results of the experiments.
  5. Observed results of the experiments
  6. Conclusions from the results of the experiments.

“The real purpose of scientific method is to make sure Nature hasn’t misled you into thinking you know something you don’t actually know. […] One logical slip and an entire scientific edifice comes tumbling down. One false deduction […] and you can get hung up indefinitely.

As a programming instructor I help students when things go wrong with the applications they’re writing. Because of my experience with the types of apps they are coding, I’m usually quick at spotting the source of the bug. Pointing out these bugs may fix their immediate problem, but it does little to correct the error in logic that led to the bug. Perhaps before coming to me, students with buggy source code should work through steps 1 through 4 from either of these lists.

If I were to mandate this for my classes, I’d have to add a step zero:

Be Prepared to Learn From Your Mistake.

New programmers are often quick to blame the language or framework they are using when their code doesn’t work. I still catch myself thinking “IT isn’t working” when I encounter troublesome bugs in my code. However, experience has shown me two things:

  1. My tools are rarely the source of my problem.
  2. If I’m not prepared to accept responsibility for my bugs, I’m doomed to repeat them.


Recommended reading:

2013-03-09 12:58:00


I first read this book thirteen years ago while backpacking in Fiji. I just finished a re-read, this time from the perspective of an educator rather than that of a new grad.

Next up is a re-read of the sequel Lila. When I first read Lila I got trapped for hours (days!) thinking about the evolution of consciousness. The end result was the essay From Instincts to Consciousness I wrote in November 2003.


Bike! - A short film about biking in Winnipeg.

We’re all part of the club
Whether you see life in pedals and spokes
Or, you’re just out for a Sunday ride
It’s about freedom
It’s not revolutionary
It’s human powered

You’ve always been a cyclist Keep moving


Art Department Rules. via

I posted these rules by the RRC BIT photocopiers.


Self-Assessment While Learning to Code

I teach computer programming in the Business Information Technology program at Red River College. Following the lead of Jody Gillis, another BIT instructor, I have added self-assessments to my student assignments.

What is self-assessment?

I ask my students to grade their own assignments using the same process I use, a weighted grading rubric. My rubrics are a collection of project requirements and instructor expectations. For each assignment a self-assessment is completed and submitted along with the project source code.

More often than not, the students assign themselves full marks with little reflection on their work. I need them to buy into the process, to see the value in it.

Why I want my students to value self-assessment.

Each week I introduce my students to new coding techniques. They must practice these new skills to learn them. Since each new set of techniques builds on skills acquired in the weeks before, a student’s ability to assess what they know and what they don’t know is essential. Insert “house of cards” analogy here. ;)

Practice Makes Better

To integrate more practice time into my courses, I’ve split assignments into two types:

  • Take Home Assignments. Five or six a term. Individual work. Assessed by me and self-assessed.
  • In Class Coding Challenges. One a week. Students can work together. Self-assessed only, but no formalized rubric.

The coding challenges provide an opportunity to experiment, to make mistakes, and to learn from direct experience. My gut feeling is that the better my students are able to self-assess these challenges and assignments, the better they will be able to direct their own learning.

My gut also tells me that my students are self-assessing once they believe no further work is needed on their assignments. I have to do a better job of explaining that self-assessment should be used throughout the development of their assignments, allowing them to reflect on and improve their code as they go.

More reading: Self-Assessment Does Not Necessarily Mean Self-Grading

2013-02-10 12:13:00


Philosophy, Physics, and Teaching

The audio lectures I’ve been enjoying this month.

Physics and Philosophy: Arguments, Experiments and a Few Things in Between
University of Oxford

Exploring links between our scientific and philosophical understanding of the world. Six 10-25 minute discussions on “the nature of space and time, the unpredictable results of quantum mechanics and their surprising consequences and perhaps most fundamentally, the nature of the mind and how far science can go towards explaining and understanding it.”

Audio Files or iTunes

General Philosophy
University of Oxford

An eight-week chronological view of the history of western philosophy delivered by Peter Millican to first-year philosophy students. Thirty-three 10-20 minute lectures.

Audio files or iTunes

Teaching and Learning

Other audio lectures I have enjoyed:

2013-01-19 16:37:00


Central Park.


Reading and Listening in 2012

I read eighteen books this year, two more than in 2011. This was a comfortable number of reads. For the most part I bought the books second hand or they were given to me. Two of the books were read on my Kobo, the rest were deadtree.

Books Read in 2012.

Shown in bold: where I bought the book, or who I got it from.

No duds again this year. I am especially thankful to Arthur C. Clarke for introducing me to Pentominos.

Currently reading:

Audio Lectures

In 2012 I listened to 23 hours of lectures across two courses. Most of these lectures were heard while running or walking with Acelyn in her stroller in various parks around Amsterdam.

I cannot recommend these enough, both for the content and the delivery by Sandel and Kagan. Both courses are available for free in audio or video format.

2012-12-31 11:22:00


IMDB Top 250 in 2 1/2 Minutes - This is our pop culture.


StungEye - The Eye of the Bee Holder


Happiness in a Broken Reality

I picked up Jane McGonigal’s Reality is Broken from the library last week. I’m about halfway through it. It’s a book about harnessing “the power of games to solve real-world problems and boost global happiness.” In 2010 when I watched Jane’s TED talk Gaming Can Make a Better World I was sceptical, but the arguments she makes in the book are compelling. I won’t get into those here. Instead, I want to highlight her thoughts on fuelling your own happiness:

“There are many ways to be happy, but we cannot find happiness. No object, no event, no outcome or life circumstance can deliver real happiness to us. We have to make our own happiness — by working hard at activities that provide their own reward. One of the chief reasons for the durability of self-made happiness is that unlike happiness derived from extrinsic sources, it is hard won. You devoted time and effort… You made it happen, and you have the ability to make it happen again. This sense of capability and responsibility is a powerful boost in and of itself. We must learn to rely less on short-lived external rewards and take control of our own happiness. In this way we become better able to protect and strengthen our quality of life. When the source of positive emotion is yourself, it can continue to yield pleasure. When the source of positive emotion is yourself, it is renewable.” — Jane McGonigal (Slightly paraphrased.)

She then goes on to explain what she believes are the keys to self-made happiness:

  • Satisfying work, every single day. The definition of which is different for everyone, but it basically means being immersed in clearly defined, demanding activities that allow us to see the direct impact of our efforts.
  • The experience, or at least the hope, of being successful. We want (need) to be optimistic about our own chances for success and feel like we are working towards that goal.
  • Social connection. ‘nuff said.
  • Meaning, or the chance to be a part of something larger than ourselves.

Be happy my friends.

2012-10-06 18:24:00