I had a great time today with Ruby Koans. It took me about 5 hours in all. A good way to spend a Sunday afternoon I suppose.
These Ruby Koans are a great way to go on a quick journey through a lot of Ruby’s common features. You basically have to edit tests in order to get them working. It’s mostly reading tests actually, but the fact that you have to fill in some blanks keeps the mind from wandering. There are also a couple of exercises which imply a bit more coding.
I have a good knowledge of Python and have worked with Ruby in the past on a little Rails project. I had forgotten anything I knew about Ruby though. Yesterday, I don’t think I would’ve been able to write a foobaz in Ruby without looking for help online. This proved to be a welcome refresher. Solving these koans gives a great tour of Ruby. As I went through them I kept thinking of how I would do those things with Python. I really like Python’s philosophy and maybe solving all these ruby koans has made me appreciate Python’s simplicity and predictability a bit more. Ruby allows for a lot more flexibility however and the koans left me to wonder at what amazing feats this language could accomplish.
I wouldn’t recommend this to a beginner however. While I think I now have a pretty good idea of what the language can do, there were no whys or recommendations about all these features. Maybe it would be a good starting point (or a dive) for someone coming from a similar language (like Python), before moving on to a good Ruby book. The website claims that they teach culture in addition to Ruby. I would’ve liked more of that. Maybe it was too subtle for me, but I didn’t notice anything other than some references to oriental philosophy:
test_assert_truth has damaged your karma. You have not yet reached enlightenment ...
There are a lot of ports of the Ruby Koans. There’s one for python and there are also a bunch for functional languages: Clojure, F#, Haskell and Scala. These look like a lot of fun, maybe I’ll try them next week.