Yesterday I attended the “Global Day of Coderetreat”. It was an event that took place all over the world on the same day. It’s goal is to bring together developers and let them code together over one day without any job pressure. By pairing with foreign people that share the same interest, one can try new methods or learn the advantages and disadvantages of other programming languages or in general improve skills.
The rules of the event are rather easy: Every round is 45 minutes long. After it there is a short retrospective/discussion what went well, what not. Then new constraints might be given (e.g. no use of conditionals and loops), all code has to be deleted and with a new partner all starts again from the beginning. During the timespan of these 45 minutes one tries to implement Conways Game of Life. It is based on four simple rules but not possible to be done right in this timeframe. The work is done in Pair Programming. This means that two people sit in front of a single computer and program/ try to solve the problem together. The overall goal is not a full implementation but the learning process - the way is the goal, so to say.
A friend of mine told me about this day and after some searching I found out that there is also one event taking place in Prague. Since my Czech language skills are not good yet (I currently do an exchange semester), I asked (via Twitter) if I still can come. The organizators agreed and so I registered for one of the 50 available slots. It ended up with all places taken and was a great experience:
The day started early in the morning. I had to catch the tram at 7:13 o’clock to be at The Hub (close to Anděl) at 8:00. When I arrived there around 10 minutes before eight, there were already circa 15 people standing in the small reception area. The old lady at the reception desk was not very happy about the fact that there was no space left and called the organizators who came down and lead us to the first floor. The Hub is a big Open Space office with many table groups, a chillout zone, a close conference room and an own bar. When I entered, I was really impressed about the friendliness and creativity this room radiated.
As it turned out, I was the only non-czech and so every official announcement was done in Czech. In general I think that everyone of these guys (yes - no female developers at this event) could speak english - but the organizators and I agreed that it would be much more cozy when speaking their home language. Fortunately there was always someone who was kind enough to translate at least the important things for me.
In the second round I paired with a C# guy. He implemented the game in the first game with his collegue in C# and without any tests. In addition, he never had experienced TDD. Since he was curious how Python works, I did another round in this programming language. When we were discussing how to implement the grid, he had had a complete different idea: His approach was to store only the alive cells in a hashmap. As a result, the grid could be extended infinitely. Unfortunately we did not reach the implementation phase of the alive calculation due to time reasons. He wanted to do this with the help keys of the hashmap. It seemed like a hack to me and I am still curious how he would have implemented it.
I changed again my partner. Again a Mac user and also interested to see the solution in Python. But I also wanted to see some new language and so we agreed to do it this time in C# (by using Mono). Until now C# was for me only Java with other keywords (using vs. import etc.). But I realized that C# has inherited many features from C++ as well. That was interesting for me. We did the development in a test-driven manner, but the NUnit runner took always around 10 seconds to start, even where we just had 4 files… This time we used an two dimensional array that we filled with instances of a cell class. This was done only if the cell was alive. Otherwise the array slot was null, because we had talked about saving RAM space before. I am not sure if this reduced the used RAM.
After three rounds we made a lunch break. The organizators had ordered so many thai food, pizzas and burgers that also the double amount of people would have got full with it. I grabbed a burger and talked to my last programming partner over the break. He was also a student and in his first semester of studying to become a Master of Software Engineering. We had a really great discussion about the sense of TDD and he told me that in his last internship he had to work with an application with over 100’000 lines of code without a single test. His argument was that “there was no time for writing them”. I asked him if he never had lectures or seminars addressing testing in his bachelor studies (also in software engineering) and he told me that he never had to write any tests. That had a deep impression on me - I mean who if not software engineering and computer science students should learn something about TDD? I recommended to him to read the book of Kent Beck, the Refactoring book of Martin Fowler as well as the book of Michael Feathers.
Then it was time for a fourth round. The organizators proposed that we should try to keep our methods under 5 lines long and the classes small with also a maximum of 3-5 methods. But it ended up being again Python, again using an array of bool values, again explaining TDD. Since this was already a lot, we ignored the “keep things small” proposal.
In the fifth round the organizers proposed to use no conditionals and no loops to solve the problem. I paired with a Ruby developer who was interested in Python - but we both were tired using our “favorite” language at this day and none of us had done a full implementation of all rules yet. Thus, we decided to use Java and to try to implement with minimal tests as much as we can in the given time period. When we explained this to one of the facilitators (the organizers walked around like coaches) he was a little bit…disappointed…but agreed since our goal was still to use another language and to train our skills. One group downloaded Google’s new language Dart and tried to work with this, to check out this new language and to test it as an alternative for their current used ones.
After the short retrospective meeting, I changed my partner for the last time on this day. The organizers suggested to “do something crazy”, e.g. writing the program without tests (what some people already did the whole time). I paired with a Java developer and we played “Ping Pong” (Person A only writes tests, Person B only production code) in combination with “Find The Loophole” (in which the the coder purposefully tries to write the wrong algorithm while passing all tests). Especially the second approach is very interesting when you realize how much (or better less) code is needed to fulfill your nice test case - without implementing any “real” business logic. First I was the test writer but we switched the roles in the middle of the time and both of us really enjoyed this session (or maybe just being a little bit “iniquitous” to the other guy). Also I again realized how much I dislike that Jetbrains (btw. a czech company!) editors, in this case IntelliJ IDEA, do not have strict line endings. I mean, you can always press the key-combination to reformat your code properly, but still it is kind of weird…
At the end of this sixth round (around 17:30 o’clock), we reached the end of the total coding session and came all together to do a retrospective before everyone went home (or to a pub). The questions every attendee had to answer were:
- What, if anything, did you learn today?
- What, if anything, surprised you today?
- What, if anything, will you do differently in the future?
Overall I really enjoyed this event and look forward to attend also in the next year if possible. Many thanks to the people who organized and guided the event as well as the sponsors that made this great experience possible!