Coderetreat is a world-wide event where software developers exercise in writing code. In particular, this Coderetreat was organized in six 1-hour sessions (45 mins for coding, 5 mins for discussion and 10 mins for a break) + 1-hour free lunch. In each session the rules were the following.
- Developers implement the same task (which was the Conway's Game of Life, described below).
- The work is done by groups of two people. The groups change each session.
- In the end of each session all the code is deleted.
The Conway's Game of Life is a self-developing world of cells that can be either alive or dead. The rules of the world are the following.
- 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.
- 4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
The whole idea of the event is that every session a set of suggestions is given encouraging developers to explore different approaches to the task implementation. In particular, the following suggestions were given session by session.
1. Developers got familiar with the task and started designing and implementing the solution without any restrictions.
2. As a result of the previous session, most of the groups had the concepts of a Board/Grid and a Cell that had a boolean state isAlive. First, it was proposed to get rid of the primitive types like boolean and replace them with abstractions. For example, the class Cell may have subclasses AliveCell and DeadCell. Another suggestion was to use "visual" tests, i.e. the tests that can be visually understood even by non-experts, because the game is actually visual. To summarize, the suggestion were:
- abstractions;
- visual tests;
- test first.
- verbs;
- methods <= 5 lines, classes <= 3 methods.
5. After the previous session the code was not deleted but each group summarized the advantages and disadvantages of their code on the paper. Then the groups changed the computers. Thus each group was given a code by another group and a summary of its strengths and weaknesses. The task was to improve the code.
6. Each group could choose one of the following restrictions:
- change a programming language;
- do not use the if construction;
- do not use the inheritance (?).
To my opinion, the event was extremely useful and it is a pity that it happens only once in a year. I think a week of such training may improve one's programming skills considerably and, in fact, there are many companies offering such courses for a huge amount of money. So all in all I would recommend everybody to participate in this event at least once.