Mike Koss just wrote an insightful essay about one of his most fun experiences as a programmer. Mike has been around the block and has worked on products like Excel, Outlook, and Sharepoint at Microsoft. He tells a story about the time he incidentally built a domain specific language using XML into Sharepoint and used that to drive the implementation. Mike says:
Then, the real fun began – the fun of being able to wear two hats – and switching between these roles. On the one hand, I was thinking of the specific web site collaboration solution I wanted to build and imagining, if I had a domain specific language (in XML) to describe my particular application, what would I want it to include to give me the power and flexibility to realize my goal? Then, I would switch to language implementation developer, and add features to my language to meet that goal.
This approach turned out to be so useful that it ended up in the product as CAML. The CAML language also turned out to be used in a surprising way – as the specification language for the product. Mike again:
Another unintended benefit was that the CAML language became an interface between people in the group. Our program managers (at Microsoft, generally the people tasked with the end-user application design) now had a specific way of asking for features from developers – they could ask for extensions to the CAML language to fill an unmet need.
I think this example shows that we end up using and building Domain Specific Languages (DSLs) more often than we realize. We might not think of them as formal languages, instead calling the technique data driven programming or the use of meta data. In fact we might not call it anything fancy at all, just thinking we are using good design techniques to keep policies and features compact, local and intentional so that they are easy to change and maintain.
I will not give away all of Mike’s story – go read his essay here.