Domain-Specific Languages
A ‘best practice’ in the Selenium world has long been to hide the complexities of your application behind a Domain-Specific Language (DSL). I’ve done it for years, as have others and I go so far in my talks to discuss exactly how one might go about doing this. So when I learned some while ago that Martin Fowler was writing a book on them (originally titled Domain-Specific Languages) I made sure I got a copy.
As Martin (I met him at Agile 2010 so will take liberties and go onto a first-name basis) puts it, this book is a duplex book in that there is a ‘Narratives’ section and a ‘References’ section. The latter being much larger than the former. The Narratives are designed to be read in order and is a pretty fast read — or was for me as I glossed over some of the ‘it would be handy to know some CS’ parts.
I really liked the tone of the book and he used ‘I’ and other first-person phrases which really made it seem like he was there actually describing the problemspace. It would have been really easy to make it a snore of a read. I also like how it comes with a ribbon attached to the spine to mark you page — that makes a lot of sense given the Reference section where you are likely to need to flip back to something.
Being a Selenium person, the big benefit of the book is that it has given me ‘official’ names for things I have been doing for [seemingly] ages.
- Se-IDE is a Language Workbench
- Selenese is an External DSL
- The selenium-client gem is an Internal DSL
- Cucumber / Robot Framework are External DSLs
It also solidified (justified?) my approach of having developers create an Internal DSL for their Selenium script and then use that as the basis of an External DSL for non-developers. You can then create a Language Workbench-ish tool (Se-IDE custom plugin) which will do Code Generation.
Is Domain-Specific Languages book of the year for 2010? Ultimately, I think not. But it is an important book if you ‘The Selenium Gal’ (or Guy) at your company or you aspire to be that person as it will help you make more informed decisions about how to evolve your framework and why people before you made the decisions they did. And that is likely enough to justify the high cover price.