Koans

8th Light Apprenticeship - Day 62

“Koan, noun, a paradoxical anecdote or riddle without a solution, used in Zen Buddhism to demonstrate the inadequacy of logical reasoning and provoke enlightenment.” wikipedia

Koans provide you with a selection of failing test cases, which you work through filling the blanks in order to get the tests to pass. They start simple, and build up on each other, until you are capable of writing simple classes or constructs that encase logic. The best part, they are driven by tests. s

They are a good way of finding out what the language is capable of, and highlight the edges and quirks, which in reality you are less likely to come across in standard code.

Once completed they act as a reference manual, so you can lookup and refer back to see syntax, layout and test structure.

Disadvantages I found were that the answer is often given in the assertion error. Once I realised this, I tried not to look at the failure, so that I could reason about my decision without having been influenced.

As most of the code is already written for you, I didn’t get a good feel of how to return values, setup a method or class. However, by using the koans as a manual, it was easy to go back and check syntax.

My conclusion - koans are a nice introduction to give you a feel of what a language is capable of, however I found it is only once you start writing your own implementations that you get into the detail and a feel for the overall structures and syntax.