Three Breaths

Musings on code, management, and life

My Day at Global CodeRetreat 2011

Posted at — Dec 4, 2011

For those of you not keeping score at home, December 3 was the Global Day of CodeRetreat 2011.  I was attending the session hosted by the Boston Software Craftsmanship group at the Microsoft NERD location in Cambridge MA.

For those not familiar with the CodeRetreat concept, the day was broken up into several pair programming exercises, with a strong focus on Test Driven Development (TDD).  The exercises were centered around Conway’s Game of Life, a simple enough problem to understand quickly, but with a domain that still allowed for a variety of challenges and corresponding implementations.  There were several  languages represented at the Cambridge retreat: Java, Scala, Clojure, Ruby, C#, JavaScript, Python, PHP,  and probably a few others.

The first exercise was a simple pairing exercise with no rules other than to meet your pairing partner and get into te swing of things.  It was a good start up exercise.  I paired with a guy named Mark, and we did the exercise in C#.  We made a few classic mistakes like getting ahead of ourselves with the design, but we did a good job of keeping each other honest and quickly got back on track.  I enjoyed the session a lot, and the 45 minutes went by quickly.

For the next challenge, I wanted to try a different language.  I have been very interested in Ruby and sought out a partner who could give me a good intro to the language.  The exercises were ratcheting up a bit, and the goal of this exercise was to make your code as clear and expressive as possible.  Good naming, clear and concise tests, good design were the goals here, and Ruby did not disappoint in that regard.  You can program cleanly or poorly in any language, I have probably done both in my years of development, but Ruby seemed to allow a clear design in a minimalist style that read very well.  Alex was my paring partner for this exercise and he was very helpful in explaining some of the nuances and conventions in the language.

For the third challenge, we got into an odd constraint.  Your code could not have any exposed primitives.  Excuse me!?!?!  No bools, ints, strings, lists.  Um…aren’t these sort of key to programming…isn’t that why the are called primitives.  But staying in the spirit of the day, this is a chance to try new things and see where the exercise takes us.  Keeping with my goals for the day to try some different languages, I paired up with someone to do some Scala.  Working without primitives was a challenge, you needed to come up with some potentially contrived abstractions, but it got you thinking.  I had seen some Scala at the VT Code Camp, and was eager to see it in action, but unfortunately, Don and I had some start-up problems getting going with Scala, so  I don’t think I saw it at its best.  I was glad I tried it though and maybe I’ll have better luck next time.

During a break for lunch, where we also saw a really wild example of the Game of Life in APL.  I used APL exactly once when I was in studying Chemical Engineering at UMass back in the day.  I had a hairy matrix problem and someone said, you know what’s really good for matrix calculations…APL.  He was right, but wow, it is not like anything I had used before or since.  We all got a good laugh out of the exercise, because of the ease at which the author solved the problem and how unfamiliar it was to our normal lives as developers in other languages.

In the afternoon, I paired up with Abby Fichtner, the Hacker Chick, for an even more challenging exercise.  This time, not only no primitives, but no conditionals either.  That means no ifs, no ternary operators, etc.  This required even more creative ways to solve the problem.  Where as before you could make a decision on the live/dead state of a cell by asking “if the number of neighbors is….”, that was not an option in this exercise.  We decided to make an array of states that we could index into based on the number of live neighbors a cell had.  We banged our heads a lot trying to figure out how to solve a problem without conditionals, but we had a lot of fun and had to think creatively to come up with what might otherwise be a straightforward problem.

Next up was a silent pairing exercise.  In other exercises, the pairs switched often between who wrote the tests and who wrote the code, but in this exercise, one person was the designated test writer and another was the designated implementer.  The exercise was intentionally adversarial, as the test writer was instructed to write tests that poked holes in the design.  It was a lot of fun to see the interaction between pairs, especially the two guys who were sitting across from me.  You could see that it was a real tennis match, with each person returning the volley of the other.  Someone jokingly (I hope) commented that he learned that talking was overrated and he hoped to do it much less in the future.

The last exercise was to do the best design you could, with no other constraints.  I wanted to try Java, so I paired up with Tarish, who kindly helped me re-remember Java.  I learned Java about 10 years ago, but haven’t done much since then.  It’s a short walk from C#, but my brain was beginning to fuse and I don’t think I put my best foot forward with Java.  Tarish was really helpful, and I enjoyed the conversations we had about Agile and TDD as we went along.

We wrapped up going around in a circle, answering 3 questions: what did we learn, what were we surprised about, and what would we do differently.  For me I learned that Boston Software Craftsmanship is a really good group.  If you are in the Boston area and you want to improve your software engineering skills you should check them out.  I was surprised at how much fun I had working with the constraints like no conditionals and how it made me have to think more creatively.  And for what I would do differently, as much as I wanted to try new languages, in some cases that got in the way of fully experiencing the challenges and constraints, so next time I will brush up on languages I am interested beforehand and try to stay in some amount of familiarity/comfort zone.

To sum up, met some great people, programmed in 4 languages (C#, Ruby, Scala, and Java), and thought hard about different ways to solve problems.  Looking forward to doing it again.

comments powered by Disqus