Friday, October 26, 2007

Meta Programming with Ruby at Singapore Ruby Brigade

Choon Keat Chew gave an excellent talk on Meta Programming at the Singapore Ruby Brigade today. He explained meta programming with a logger example. Generally in Java we program to the interface and subclass existing classes to introduce new features. But in Ruby you could directly implement the new method or feature to the object and it instantly gets reflected over the entire scope of the program. It is kinda dangerous in large teams, since anyone can override existing classes and change their behavior by modifying their methods. He also discussed extensively about method_missing , *args feature in Ruby. From what I understand the method_missing function lets you avoid "method not found exception", and also generate setter/getter and other simpler functions automatically. This is one case where meta programming is explicitly visible. He also discussed about simplicity of Rake. Implementing a simple task with Rake will take a lot less time compared with Ant. We also discussed about ducktyping, design patterns and readline library in the end.

No comments: