Domain Specific Languages explained
The idea of creating internal DSLs in programming languages has always seemed kind of awkward to me. How can you create a DSL in Lisp for example? It would just be a collection of classes and mehtods/functions that you call - in other words a library or an API and with those pesky parentheses on the top. And to be honest, I’ve never dug any deeper into this subject, because it only seemed a fancy name for an old thing to me.
But yesterday while browsing the most popular Ruby questions on stackoverflow, I found a link to a very nice presentation on DSLs (PDF) by Obie Fernandez. It kind of opened my eyes on what it is all about and, what is more important, nicely showed what were the initial ideas behind RoR. Make it a DSL for writing web applications!
And I really liked this quote from Jamis Buck:
“The fascinating thing is that, in my experience, most well-written Ruby programs are already a DSL, just by nature of Ruby’s syntax.”
I think it really helps to remember what you should expect of yourself when writing a new piece of code in Ruby.
PS. Two years is a pretty nice interval between blog posts, isn’t it? At least a realistic target for me ;). Guess one shouldn’t have taken the “I’ll be writing more about that soon” seriously.
Useful URLs for RoR 2.0
I spent last evening coding a new web app in RoR 2.0 till 2 a.m. This is fantastic how smooth and enjoyable the experience is. Although I had previously coded a few other apps in RoR and I loved it too, this time it was even better.
I feel it’s mainly because I found a ton of great tutorials and documentation I didn’t have previously. And although I own the 2nd edition of the Rails book it doesn’t cover the RESTful features deeply enough and this is the killer feature in 2.0.
Here’re some URLs that I think are worth sharing:
- Railscasts - a fantastic collection of free RoR screencasts by Ryan Bates
- attachment_fu plugin by Rick Olson and a great tutorial by Mike Clark
- acts_as_commentable plugin
- role_requirement and restful_authentication plugins
Hope it’s useful!


