What is Code Retreat ?
45 Minutes is quite a short period of time to work on a project let alone complete it, but that is what we attempted to do at code-retreat on April 14 2012. But the goal was never to complete it. Confused ? Read on →
Code retreat is a unique exercise invented by Corey Haines to hone the art an skill of software development.
Coderetreat is a day-long, intensive practice event, focusing on the fundamentals of software development and design.
The day consists of about 4-6 iterations of 45 minutes each and the code written is deleted after each session. The participants try to solve a problem which is un-solvable in 45 minutes by paring up as teams of two. The teams are changed after each iteration. So no participant works with another participant more than once.
Collabnet chennai was gracious enough to put us up with a venue at the 11th hour. We had Mr.I Jeyanthan to thank for that .
The facilitator is the person who guides all the participants on the methodologies and the techniques of Test Driven Development. We were honored to welcome Dr.Venkat Subramaniam as our facilitator. He introduced us to a new way of thinking about the art programming.
The problem that we attempted to solve was Conway’s Game of Life. The rules of the game are simple to understand but are as complex to code as you think it is .
* Any live cell with fewer than two live neighbors dies, as if caused by under-population. * Any live cell with two or three live neighbors lives on to the next generation. * Any live cell with more than three live neighbors dies, as if by overcrowding. * Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
During the first Iterations many of the participants had no clue as to what TDD was, and we just cranked out code and hoped it would work. At the end of the iteration we were asked to talk about what we did and the experience of it. This made us understand the importance of Testing Code.
In the second Iteration people who did not know about TDD paired up with people who did, This resulted in almost everyone understanding at least one testing framework and what Unit tests were, by the time the second iteration was finished.
The Tokyo Connection
JUG-Chennai lead Rajmahendra had heard about some Code Retreat happening simultaneously at Tokyo and we decided to call them and say Hello. There was a discussion about the languages used and the Tokyo Guys were using Small Talk to solve Game of life. Since they were about 3 hours ahead of us, by the time we called they were already into the last iteration.
During the third iteration we had come up with ideas on how to store the Grid. Most people went with a 2D array but other approaches like using a Hash-Map and using a Position Object were also tried.
In the final discussion before lunch we talked about why Testing was even necessary and whether it slowed the rate of development. We were given some interesting analogies to think about by Dr.Subramaniam like how doctors in the 19th and early 20 Century rejected Lister’s germ theory and finally everyone realised the importance of Hygiene.
Writing code without Tests is like performing surgery without washing hands .
Post lunch iteration had a big slump in productivity as nothing really intriguing came of it. Someone had pointed out in the retrospection on why writing Hash Maps after lunch was a big mistake .
In the next session since we had all recovered, we tried doing some useful code and many came close to the solution and still managed to write some tests to back it up.
The final Iteration was a General discussion on many topics like productivity, The power of functional languages etc.
Finally As a note of appreciation to collabnet, Dr.Venkat Subramaniam enlightened us ways to improve the way we communicate by using Version Control Systems, especially Subversion.
He showed us why using email for conversations/ sharing files was evil and how using VCS made things more intuitive.
By the end of the day everyone was infected with the TDD bug and how the shift in paradigm to writing tests before writing code made a huge difference in the quality of the software .