Learn Ruby with the Neo Ruby Koans

ensoThe Ruby language site lists some resources for beginners in their Documentation section. Most of them followed the usual pattern of online language courses, but the Ruby Koans stood out. It is a language lesson by the way of test-driven development. The entire course is in the form of a single Ruby program full of test cases (280-ish when I downloaded it) that all fail. The job of the Ruby student is to look at the test case, understand what the test requires, modify the test case so that it succeeds, and proceed to the next one.

The very first test case is simple – true versus false. Then it progressively built up from there. Data types, flow control, object hierarchy, the works. While this covers much of the same ground as the Codecademy course I took a few days ago, the presentation and the format kept me engaged in a way the Codecademy course did not.

One reason was that it’s possible to “fast forward” through sections I understood: The test cases are all there in Ruby source files. So once I understood the concept covered by one test case, I can continue editing the similar test cases and have them all passing in one batch instead of one case at a time. In contrast to something like Codecademy where, even if I understood the concept, I still had click through the pages one at a time.

Bonus: after I finish the lessons, I have a bunch of Ruby files exercising various Ruby concepts that I can go back and look at for reference. It is much faster to scan through a Ruby file than it is to click through a Codecademy lesson.

This Ruby Koans approach to learning Ruby might not work with everybody, but I loved it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s