Inspirations for a Ruby DSL
September 6th, 2009
Recently, during discussions with a client about reducing the amount of boilerplate coding that recurs from time to time in the project, the idea of developing a Domain Specific Language (DSL) arose. If you’re wondering what a DSL is, here is what Martin Fowler has to say. Or, you may prefer this cheeky piece from Dr Nic Williams.
I’ve been intrigued by DSLs for some time but not had the motivation to develop one until now.
In preparation, I’ve gathered a list of resources for writing a DSL in Ruby.
Tutorials
- Russ Olsen’s two part article
- Chapter 16 on DSLs in Russ Olsen’s “Design Patterns in Ruby” book
- Mischa Fierer’s three part article about writing a clean Ruby DSL
Examples
- Pete Yandell’s machinist
- Javan Makhmali’s whenever, which provides a clean Ruby syntax for defining cron jobs
- Ben Schwarz’s smoke (also see this video)
- Marcus Crafter’s sprinkle (also see this presentation)
- Cucumber, the behaviour driven development DSL
I’m happy with that list of resources but if anyone has any other suggestions please feel free to comment.
My next challenge is to think about the problem domain and design an elegant syntax.
Navigation
Latest Blog Posts
- 11 Aug: RVM, Bundler and Ruby Tracker
- 10 Feb: Ten Years On
- 10 Oct: Configuring CapGun
- 6 Sep: Inspirations for a Ruby DSL
- 28 Jul: At Your Service
Syndication
Tags
actionwebservice automated testing bdd blog bundler capgun capistrano collaboration css cucumber deployment dsl estimating jaoo javascript osdc osdc2008au pdf prawn rails railscamp rake rest rorosyd rspec ruby ruby tracker rvm selenium services syntax highlighting tdd technology unconference wds08 web design webrat xml xml-rpc