At least the one I attended on Saturday – My first one.
What is a code retreat, you’re asking?
A bunch of people who want to improve their coding and unit testing skills meet for a day. Everyone has their IDEs and testing frameworks ready to go. You get to tackle the same problem multiple times. We had 7 blocks, each consisting of 45 minutes coding followed by 15 minutes retrospectives. In each coding phase you pair program with someone else. To spice things up, there’s a new constraint for each round, e.g. “No IF-statements allowed”. After each round you throw away the code. Wait, what? Throw code away? *gasp* Heresy!
Why would you do a code retreat?
For deliberate practice. There’s this famous analogy: Musicians spend a lot of time practicing, then give a few concerts. Software developers – who often build something they’ve never build before – spend all of their time “giving the concerts” and hardly ever just practice the basics, let alone with someone else. A code retreat is an opportunity to learn:
- new ways of thinking / approaching a task from your pairing partner
- to take really small steps
- new languages
- new shortcuts, IDEs, frameworks, …
- to throw away code
Our constraints for the 7 phases were:
- Ping-Pong – A writes test, B writes code to pass test, B writes next test, A writes code to pass test, …
- Law of Demeter – No more than one “.” per expression allowed, so no objectFoo.getBar().doFoo() – Following this law leads to looser coupling
- TDD as if you meant it
- No naked primitives – No ints, no booleans, …
- No If – Yeah, that’s a hard one…
- Each pair could choose individually from a long list – We chose “Find the loophole”
- As I’m not a developer, I was afraid to slow my pairing partners down. No need to worry: Code retreat tasks, such as the classic “Conway’s Game of Life”, are quite simple and there were other non-developers attending.
It helps if you’ve at least seen unit tests before, though.
- I take way too big steps
- In the “no primitives” round I learned to use enums instead of booleans and they make the code more “speaking”
- A code retreat is great fun, but also exhausting. 7 sessions is one too many.
Next I’d like to attend a Legacy code retreat, where you learn to refactor old brittle code.
Patrick and Stephan blogged about the same retreat:
- Retrospective – Patrick (who facilitated the retreat)
- Attending a code retreat – Stephan (writes from a tester’s perspective)