The Ruby Koans Are Still Awesome
That’s right. The Ruby Koans are still awesome.
Within the last month, I joined a project that is using Ember for the front end of the application, and Rails for a backend API.
I haven’t done much with Ember yet, but I have been working with Ruby on other projects, so I don’t completely feel like a fish out of water. Emphasis on completely.
But after working with .NET for the better part of the last decade, it always feels a little weird to jump back into the command line and try to get my Ruby on.
Enter Ruby Koans
Running through the Ruby Koans has turned out to be a great refresher of the Ruby language.
The Ruby Koans are a collection of exercises to walk you through the intricacies of the Ruby language - syntax, structure, libraries, etc. And because the authors value testing, all of these exercises are presented as a series of tests for you to work through, all the while learning the syntax of the Ruby language. This learning path is what Ruby Koans refers to as the “path to enlightenment”.
I’ve made my way down the “path to enlightenment” with Ruby Koans before - this isn’t my first walk around the Ruby Koans block.
But each time I go through them, I find myself being consistently inspired by one important point.
Testing = Culture
With Ruby Koans, learning happens through the use of tests. Run the tests, examine the error message, and then examine the test.
From here, you start asking yourself a couple questions. Why the test is failing? What is the test trying to verify? You then start changing the code to get the test to pass. And, often times without you even knowing it, you end up learning something new about the Ruby language along the way.
When you get started with Ruby Koans, you may interpret the “path to enlightenment” as the process of learning the Ruby language. And maybe that’s true.
But once you’ve finished walking the path, you will most likely find yourself redefining the “path to enlightenment”. Maybe, instead of teaching you the ins and outs of the Ruby language, the “path to enlightenment” is really the process of learning how to test our code - specifically by writing tests first, and then writing the code that makes these tests pass.
The “path to enlightenment” is less about teaching you the syntax of the Ruby language and more about how to be a better developer. This is the broader lesson.
The koans are now maintained by a company named Neo, but were originally created by Joe O’Brien and the late, great Jim Weirich.
RIP Jim.