Writing Internal DSL’s in MSDN

My latest and last (for the moment anyway) article for MSDN just went up today.  This time I tackled the design patterns and strategies for building Internal Domain Specific Languages.  At least in the .Net space, the mainstream folks seem to hear “DSL” and only think about big efforts to create business facing languages with external DSL tools like Oslo — probably because that’s been their first exposure to the idea of DSL’s.  That stuff is valuable in places, but don’t overlook the value in creating small mini-languages inside your everyday programming language for developer related tasks. 

Mini-language or Internal DSL‘s may be a misnomer in this case.  All you’re really attempting to do is to create a more usable form of API that ends up being more readable and quicker to specify than the standard “push button” API.  You see more and more examples of these little internal DSL’s in open source tools like Fluent NHibernate, StructureMap, Windsor, and AutoMapper.  Now even Microsoft is dabbling in mini-languages with the “Code Only” configuration option in Entity Framework 4 (which at a glance seems determined to replicate every single mistake that Fluent NHibernate made early on).

I’d hoped to include much more writing on this topic in my blog, but I’m a bit burnt out at the moment.  At some point in the next month I’d like to write up my lessons learned with the StructureMap Registry DSL and how it’s evolved over the past three years to improve its usability, the problems users have had, dumping the “English like” syntax in favor of something terser, and how I build the DSL stuff.  Also, I’d like to explain the “Object Scoping” pattern that got cut from this article.  Lastly, I’ve got a little Internal DSL we use at Dovetail for user action routing that I think would make a good, approachable example.  I’m on a bit of a New Year’s Resolution to spit out more (any) blog content.

Lastly, I’d like to write up a retrospective on the whole Patterns in Practice column I’ve been writing for the past two years.


The pattern names for the article and much, much more information were drawn from Martin Fowler’s online draft for his DSL book at http://martinfowler.com/dslwip/.  I’d heartily recommend perusing the site if you’re interested in DSL development at all.

About Jeremy Miller

Jeremy is the Chief Software Architect at Dovetail Software, the coolest ISV in Austin. Jeremy began his IT career writing "Shadow IT" applications to automate his engineering documentation, then wandered into software development because it looked like more fun. Jeremy is the author of the open source StructureMap tool for Dependency Injection with .Net, StoryTeller for supercharged acceptance testing in .Net, and one of the principal developers behind FubuMVC. Jeremy's thoughts on all things software can be found at The Shade Tree Developer at http://codebetter.com/jeremymiller.
This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://johan-jonasson.blogspot.com/ Johan

    You mentioned IronRuby and Boo in your article. I want to add F# to that list too. It’s a really good choice to create internal DSLs with.

    Take care and rest!

    //Greetings from Sweden again

  • Christoffer

    Great stuff! Keep up the good work. This is my best blog bookmark ever.

    //Greetings from Sweden.

  • alwin

    Please take it easy. You write great stuff but it’s not worth getting burned out for.