Friday, September 08, 2006

Teaching Ruby on Rails

Despite nearly a year of programming with the Ruby on Rails framework, teaching the subject is quite a different beast. A few months ago I mentioned Ruby on Rails (RoR from here on) to my cousin who then mentioned it to her boss that runs a training center in Columbia, Maryland. The more he read about it, the more excited he became about its potential growth. By this time I had moved to the DC area and was just an hour's drive away so it wasn't too long before I got a phone call inviting me to talk to him about RoR.

Now understand that I am very passionate about programming in RoR, even to the point of being evangelical about it. Michael, who runs the training center, has a background in programming and he immediately latched onto the power of a dynamically-typed, very expressive language such as Ruby. The presence of the Rails web framework, which makes J2EE look like a Model T, was an added bonus.

My lesson plan was centered around a two-hour presentation split between Ruby and Rails. For the Ruby half, I used Pickaxe as my template. It's such a well-organized book in how it teaches the Ruby language. Yet translating that into a one-hour class gave me cause to worry for the entire week leading up to the session. Eventually I settled on a "write as you speak" approach. Seeing as I'm a better programmer than public speaker, I wrote a small application that hit on all the major points of the Ruby language and printed out the code as a reference. Then over the course of the first hour, I rewrote the program from scratch stopping to answer questions or to highlight anything that wasn't immediately clear.

The second half of the lesson centered around Rails though after a small break I had only 45 minutes left. I must point out here that even though an intimate knowledge of Ruby is not required for developing applications in Rails, on a personal level I think it helps immensely, especially if you need to roll your own plugins. But with less than an hour to show off the power of Rails, I decided to go with a simple CRUD application relying mostly on scaffolding to generate the controller and views.

I got the feeling that the audience came from a Java background and that the Rails portion of the class was really what they came for. So after creating my basic application, I opened it up to questions and boy did they have questions! They ran the full gamut and consisted of things like "How do layouts work?" all the way to "Is Rails ready for the enterprise world?" (such a loaded question coming from a Java programmer!).

All in all, it was a great experience and looking back it's strange to think why I was so nervous. Within a few minutes of the class starting I settled into a routine and when it was over it was difficult to imagine that those two hours had flown by so quickly. I look forward not only to continuing to evangelize RoR but to teach it as well if given another opportunity.

No comments: