December NoVA Ruby Users Group

Last night we had excellent turn-out at the Northern VA Ruby Users Group. Rich Kilmer gave an enlightening talk on Domain Specific Languages and Devin Mullins delivered an interesting performance piece on Rails plugins where he wrote code while singing about it (ensuring that the code matched his meter and rhyme). Rich’s presentation was very similar to his previous presentation on the DSL he wrote for the Coronet refueling missions for the USAF. He began by giving a definition of DSL (from Martin Fowler) and then speaking about External and Internal DSLs. Since the focus of his talk was on internal DSLs written in Ruby he provided a further division between explicit and implicit DSLs. His example of an explicit DSL was:

when_shopping do |store| 

  store.buy :popcorn 

  store.buy :soda 

end

You’ll notice in the explicit case the syntax of Ruby is clearly visible and a store object is created which the buy method is invoked upon. Here is his example of an implicit DSL:

when_shopping { 

  buy :popcorn 

  buy :soda 

}

In this case, the code is more declarative: when shopping buy popcorn and soda. Rich appeared to prefer the latter form. He did show an issue with the implicit form when attempting to access member variables like so:

extend ShoppingTrip::Behavior 

@amount = 6  

when_shopping { 

  buy :popcorn 

  buy :soda, @amount 

}

This code won’t work because the block is invoked in the scope of the ShoppingTrip instance where there is no @amount variable. The explicit DSL doesn’t have this problem. When Rich makes his slides available, I’ll update this post to point to them. Devin walked through the creation of a Rails plugin while singing about what he was typing to the tune of “Dance of the Hours” by Ponchielli. He showed how you can extend your models using plugins and went through some of the files created when running script/generate plugin. Tonight, we also had Chad Fowler as a guest. It was nice to finally meet him in person, though I didn’t get much of a chance to speak with him as he was quite popular with the other attendees. He did mention that he’s left Naviance and is providing training and consulting services. Hopefully when I attend The Rails Edge in January I’ll be able to chat with him some more. I also had the pleasure of meeting Luis de la Rosa who took the plunge and went indie (though he’s supporting himself primarily through consulting, which I don’t call ‘indie’). But I’m rooting for him and hope he does well—I tried the contractor route very briefly after my break with Cisco and I can say I just don’t have the stomach for it (plus I’m the sole provider for my family and the uncertainty was just too much stress). I’d definitely like to improve my ObjC/Cocoa skills and look forward to the next CocoaDevHouse (that Luis will help organize). Next month at NoVA RUG we’ll have presentations on Rails deployment and Selenium.