CodeRetreat - Honing your Craft as a Programmervaishnavi
March 2, 2015
Have you ever wondered on how to get better as a Programmer?
CodeRetreat is a day long event to challenge yourself to grow. It stretches your skills and understanding of writing and designing elegant code.
Read on to understand more.##What is CodeRetreat?
It is a day-long event.
The problem is the same : Conway’s Game of Life.
5 or 6 programming sessions : 45 minutes each, followed by retrospections on each session.
Pair-programming is necessary.
After each session, pairs should be swapped.
After each session, code must be deleted, not put in a branch, not stashed, just deleted with no trace left.
It is preferred to use Test-Driven Development (TDD)
What is the Problem?
In 1970, mathematician Rob Conway came up with a few rules called the Conway’s game of life. The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells. Each cell is either alive or dead. Every cell interacts with its neighbours to determine its state at the next tick.
How deleting code makes you a better programmer?
In our daily lives, maintainable code is valued a lot. But in a CodeRetreat you can explore different approaches of problem solving. You can start each session with a fresh outlook to solve the problem with a new technique.
Deleting code is somehow similar to the Zen ritual of building sand castles with intense focus and then destroying them. You develop the habit of doing your best work decoupled from the end result.
Why “Pair Programming” with different partners?
Two programmers come together and solving the same problem. Sounds fun?
But it is proven to actually produce better code. Pair Programming allows you to learn at a much faster pace. You learn more in a few hours than you would in weeks.
There are the obvious advantages. Discussing a problem leads to better understanding of it. Collaborating make you learn new techniques and shortcuts.
Pair Programming also gives us an opportunity to practise Egoless Programming. Programmers have the natural tendency to treat their programs as part of themselves and therefore reject all criticism. The antidote is treating code independent from yourself and taking feedback dispassionately.
Pair Programming leads to collective ownership of code. Collective ownership can be scary as you have to be comfortable to admit your mistakes and incorporate new changes, which is hard work. But the more the ownership of a codebase, the higher the quality. The most popular open source software are the most tested and are of the highest quality in terms of design.
As Linus’s Law states "given enough eyeballs, all bugs are shallow”.
Are all sessions similar?
No. There are additional rules and constraints in some sessions.
In most sessions the focus is on practising the rules of Simple Design. Once participants are comfortable with the problem - Conway’s Game of Life, constraints are added in subsequent sessions. Constraints drive creativity in problem solving.
In one of the sessions we had, the constraint was to use the principle of pure OOP - no returns. It was incredibly hard to come up with solutions keeping that constraint in picture. In the end, people came up with very interesting solutions. One of them was using event listeners, node.js style, but in ruby and using ruby blocks to act on the data and not return anything.
In some sessions, the constraint was to use Test Driven Development (TDD). For some it was their first experience with TDD. For people who were already using it, it was an opportunity to teach TDD concepts to beginners. Some of the insights that are always shared by beginners on using TDD are :
Focus on one rule at a time.
More confidence in the validity and correctness of code.
Continuously changing, restructuring and refactoring code all the time.
What language do I use to code?
Whatever language you want to. Want to use your favorite programming language, cool.
Curious about a different language or paradigm(i.e. functional programming or logical programming), go for it. You can get an opportunity to pair with someone already familiar with it. We had participants who tried out Perl, Scala and Elixir for the first time.
You have to be intentional about learning. The more you are open to experimentation, the more rewarding the experience from a CodeRetreat.
If you are excited about CodeRetreat, you can come and participate next time. We organize one every now and then. To know about the next, please follow us on Facebook or Twitter.
Still want to learn more about CodeRetreat..