Review of the screencast series The Ruby Object Model and Metaprogramming (episodes 1-3)

Even if you’re new to the Ruby community, you are unlikely not to have heard about the Pragmatic Programmers, who are well reputed for publishing great programming books. You may not have noticed that lately though, they’ve also been releasing several series of screencasts.

Each episode lasts about half an hour and sells for a mere $5. This strategy will work well in their favor because screencasts are a great way to teach programming. So far they’ve put out 5 series: Expression Engine, Core Animation, Erlang by Example, Everyday Active Record and, their latest entry, The Ruby Object Model and Metaprogramming.

If you are reading this blog, I’ll assume you’re mostly interested in the last two topics. I haven’t had a chance yet to watch the Active Record ones, so I can’t say much about them, other than that I have faith in their author, thanks to his magnificent work on the Railscasts.

Today after work however, I spent about an hour and a half watching the first three available episodes of The Ruby Object Model and Metaprogramming. This is a brief review of my thoughts on them. In short: they’re fantastic. But let me provide you with a bit more of a in-depth analysis than that.

These screencasts shine for the simple reason that you feel as though you’re sitting right there, next to a master programmer like Dave Thomas, as he explains Ruby concepts in detail to you. Whenever you’re not very clear about a concept, you can go back and listen to the explanation as many times as you’d like. You can pause, experiment with irb, and then go back to the screencast. After watching the first episode, I though that the $5 price was a steal.

Currently the following three episodes are available:

  1. Objects and Classes (29 mins)
  2. Sharing Behavior (39 mins)
  3. Dynamic Code (31 mins)

The first episode lays the groundwork for the series and introduces a useful diagram that enables you to easily visualize the Ruby object model correctly. Concepts like singleton methods and ghost classes are really well explained. The first episode also covers ‘self’ and the concept of current class, which is often confusing to beginners.

The second episode explores what constitutes good object oriented design, as well as the usage of prototype programming, inheritance (and how not to abuse it), and finally an excellent explanation of modules and mixins. If you are a beginner you may not know the difference between including and extending a module, or the true power of mixins. Fear not, the last part of second episode really covers those subject well.

The third episode starts by defining blocks and their usage, including the difference between lamdba and Proc.new. It then moves on to explore the concept of bindings capturing the execution context, and the importance of closures in metaprogramming. The last 12 minutes or so are spent dealing with the subject of dynamically defining methods, which is at the heart of metaprogramming, and the video includes a nice example of how to create your own version of attr_accessor by defining, in a module, a method that dynamically defines getter and setter methods.

I’d say that aside from the feeling that I was enjoying a “private lesson”, what I liked the most was the coding style recommendations about when to employ a given concept and when to opt for something else. The examples were clear and easy to follow as well.

I can’t recommend this series highly enough to any Ruby programmer with a basic grasp of the language. I feel that intermediate developers will get the most out of these videos, but they’ll also definitely be very beneficial for beginners. Real experts shouldn’t find any alien concepts, at least in the first three episodes; I know I didn’t. Yet, they’ll appreciate, just like I did, the fresh slant when it comes to reviewing some of the illustrated concepts and examples. There will also be a few “ah-ah!” moments here and there, I guarantee you.

Five stars, and I’m certainly looking forward to future episodes.

Get more stuff like this

Subscribe to my mailing list to receive similar updates about programming.

Thank you for subscribing. Please check your email to confirm your subscription.

Something went wrong.

5 Comments

  1. Subbu June 12, 2008
  2. Oscar Del Ben June 12, 2008
  3. Jim Neath June 12, 2008
  4. Paolo DonĂ  June 12, 2008
  5. Trevor Turk June 12, 2008

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: