Tag: Pair Programming

Expressing Expectations

Long long ago, while preparing experiments for my diploma thesis in physics, my tutor taught me to express my expectation of the outcome of experiments before actually running them. I was to not only to express them in my head, but speak them out loudly, may be even make a note.

This helped a lot, when figuring out where my thinking didn’t match the experimental evidence. There was no denying when my expectation differed from the empirical result. Typically, there were two sources for the differences:

  1. My mental model wasn’t good enough to match the result of an experiment.
  2. The experimental setup wasn’t designed well enough to show the effect I was trying to measure.

I find that this is still working well in software development (both the coding part as well as testing). A related article about this is Peter Naurs seminal paper ‘Programming as Theory Building’.

When doing TDD (test driven development), explicitly expressing the outcome before running a test may not always lead to a surprise. In the very beginning, when a test tries to create an object, without having a class definition, it will cause an error message that is easy to predict.

However, when work has progressed a bit, I regularly run into situation where I expect the next new test to fail in a certain way, but when running the test, the actual error message is a surprise to me. These are situations where learning can happen, by figuring out why the actual behaviour does occur, instead of what I predicted.

Near the end, the surprise is caused differently: I’ll write a new test and expect it to fail. – It doesn’t. Again, this is a good reason to explore why exactly I thought the test would fail.

Particularly in a pair (or ensemble) programming setup, the inability to come up with a new failing test is a sign, that the implementation is good enough … for now.

Recently, I did a programming exercise as part of a technical interview, and expressing my thoughts and expectations while working on the code helped me to find a solution. Additionally, the interviewer didn’t only see what I was typing, but could follow my way of thinking. This relates to Naur’s paper mentioned above: The testing and tested code I wrote isn’t everything there is to my mental model of the given problem or its solution. The way of thinking is important too. This is why I find vocally expressing my expectations & thinking while actually doing the work.

What are your preferred way to actually do the work you’re doing? I’d love to hear about it.

Attending a Code Retreat

The “Softwerkskammer” regional group of Düsseldorf, Germany organised its first Code Retreat this weekend (1. Sept. 2012), which I attended. The facilitator, Patrick Cornelißen (of orchit), has posted a summary of the Code Retreat, so I won’t repeat him, except for stating that the task was “Conway’s Game of Life” and we wrote code in 6 time slots (45 minutes each) each one followed by a 15 minute retrospective. Here are my observations and notes:

About the programming and pairing

First of all I found it super exciting to get pairing with programmers. Although not every one else was a programmer, I was the only tester attending and I found pairing up with programmers very exciting (Would my coding skills be sufficient?), productive and fascinating.

One pairing partner made me write the tests in much smaller steps, than I would have ever done. After struggling with the approach of implementing the desired functionality in the test (without defining any method or class), I finally realised just how small steps are possible. Those were really tiny steps. It occurred to me rather late in the slot, that what we created was a rather functional way to solve the problem. In a later slot I asked Sergey Shishkin to pair program using Clojure.

One (kind of) surprising constraint we were offered, was to avoid if-then-else and case constructs by using polymorphic dispatch. Apparently this approach was a challenge for nearly every one, see Partick’s tweet about it:

Verwunderte Gesichter bei der Vorstellung des “No-If” Constraints 🙂 #coderetreat

General remarks, tips and an observation

  1. When pair programming using a notebook, especially a relatively small notebook, I recommend using an external keyboard. If you’re limited to the internal keyboard either the ‘driver’ can’t easily type on the keyboard or the ‘co-pilot’ can’t easily watch what’s happening on the screen.
  2. If you want to learn more about your favourite programming language, editor and/or IDE, attend a Code Retreat.
  3. Pairing for the first time and/or pairing with people you didn’t meet before will give you new ways of thinking and programming.
  4. I was the only tester and the only one who used fork and knife at lunch time when eating pizza. 🙂 However, I used my hands like everyone else in my second serving. 😉

I very much enjoyed the day. Thank you to everyone involved!

Navigation

%d bloggers like this: