Domain Specific Languages (DSLs) – In General and How PowerShell Relates
While attending JAOO, I had the great pleasure to meet and talk with Martin Fowler and Neil Ford on the topic of Domain Specific Languages (DSLs). Channel 9 videotaped that discussion and you can watch it HERE.
I’m quite passionate about DSLs – both FOR them and AGAINST them. The details matter!
I have this concept called, “Beer Cardinality” and it applies to DSLs. Here is the way it works:
Have no beers => Yawn!
Have 1 beers => What’s the point?
Have 2-6 beers => Happy Happy!
Have 24 beers => Vomiting, hangovers, regret regret regret
DSLs are awesome BUT if you have too many, it can lead to a nightmare. Let me draw a distinction and be more precise – there are SYNTAXes and there are VOCABULARIES. It is fine to have a zillion Domain Specific Vocabularies (DSVs) but you only want small set of Domain Specific Syntaxes.
1) I give you a 20,000 line file written as an external DSL and that DSL can do exactly one thing – it can generate Strings.
Now I say, you have to run that on your production server. Consider what level of QA you have to do in the 2 cases. In case 1 – you KNOW with metaphysical certitude that the DSL can ONLY generate strings. In case 2 – it can do anything but is optimized for generating strings.
See my point?
So what you want is both internal and external DSL. Hmmmmmm, that would explain why we have the DATA segment as part of PowerShell V2. This gives you the best of both internal and external DSLs. Notice that in our DATA segments, you can specify -SUPPORTEDCOMMANDS – this gives you the ability to specify a DSV. Yummmmmm!
People have no idea of the power and flexibility that they are going to get with PowerShell V2. It is going to be awesome!
BTW – I went to Martin and Neil’s talks and they are super smart guys and I highly recommend going to any talk they give. Great stuff. Truly enjoyable. I didn’t agree with it all (as you’ll see from the interview) but it was all worth listening to.
Jeffrey Snover [MSFT]
Windows Management Partner Architect
Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scriptcenter/hubs/msh.mspx