{"id":17882,"date":"2010-10-08T13:00:44","date_gmt":"2010-10-08T21:00:44","guid":{"rendered":"http:\/\/devblogs.microsoft.com\/powershell\/?p=17882"},"modified":"2019-06-07T13:02:35","modified_gmt":"2019-06-07T21:02:35","slug":"domain-specific-languages-dsls-in-general-and-how-powershell-relates","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/powershell\/domain-specific-languages-dsls-in-general-and-how-powershell-relates\/","title":{"rendered":"Domain Specific Languages (DSLs) \u2013 In General and How PowerShell Relates"},"content":{"rendered":"<p><P>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).&nbsp; Channel 9 videotaped that discussion and you can watch it <A href=\"https:\/\/channel9.msdn.com\/posts\/Charles\/Jeffrey-Snover-Martin-Fowler-and-Neil-Ford-Domain-Specific-Languages\/\" mce_href=\"https:\/\/channel9.msdn.com\/posts\/Charles\/Jeffrey-Snover-Martin-Fowler-and-Neil-Ford-Domain-Specific-Languages\/\">HERE<\/A>.<\/P>\n<P>I&#8217;m quite passionate about DSLs &#8211; both FOR them and AGAINST them.&nbsp; The details matter!<\/P>\n<P>I have this concept called, &#8220;Beer Cardinality&#8221; and it applies to DSLs.&nbsp; Here is the way it works:<\/P>\n<P>Have no beers&nbsp; =&gt; Yawn!<BR>Have 1 beers&nbsp;&nbsp;&nbsp; =&gt; What&#8217;s the point?<BR>Have 2-6 beers =&gt; Happy Happy!<BR>Have&nbsp;24 beers&nbsp; =&gt;&nbsp;Vomiting,&nbsp;hangovers, regret regret regret<\/P>\n<P>DSLs are awesome&nbsp;BUT if you have too many, it&nbsp;can lead to a <SPAN style=\"FONT-FAMILY: 'Arial','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA\">nightmare<\/SPAN>.&nbsp; Let me draw a distinction and be more precise &#8211; there are SYNTAXes and there are VOCABULARIES.&nbsp; It is fine to have a zillion Domain Specific Vocabularies (DSVs) but you only want small set of Domain Specific Syntaxes.&nbsp; <\/P>\n<P>There is also a very interesting discussion around Internal vs External DSLs.&nbsp; Internal DSLs are essentially DSVs for particular languages Javascript, C#, PowerShell etc.&nbsp; External DSL are distinct, self-contained elements orthogonal to the engine and language used to implement the engine (which processes the DSL artifact).&nbsp; The problem is that you want BOTH.&nbsp; You want the syntax of an Internal DSL so you don&#8217;t have to learn a set of skills which put your resume into the bit bucket.&nbsp; You also want an external DSL so that you can create artifacts with a well define scope of effect to facilitate transferability of the artifact.&nbsp; Consider these 2 cases:&nbsp; <\/P>\n<P>1) I give you a&nbsp;20,000 line&nbsp;file written as an external DSL and that DSL can do exactly one thing &#8211; it can generate Strings.&nbsp; <BR>2)&nbsp;I give you a 20,000 line file that is Java, C#, JavaScript,etc and I tell you all that it does is to generate strings.&nbsp; <\/P>\n<P>Now I say, you have to run that on your production server.&nbsp; Consider what level of QA you have to do in the 2 cases.&nbsp; In case 1 &#8211; you KNOW with metaphysical certitude that the DSL can ONLY generate strings.&nbsp;&nbsp; In case 2 &#8211; it can do anything but is optimized for generating strings.<\/P>\n<P>See my point?<\/P>\n<P>So what you want is both internal and external DSL.&nbsp; Hmmmmmm, that would explain why we have the DATA&nbsp;segment as part of PowerShell V2.&nbsp; This gives you the best of both internal and external DSLs.&nbsp; Notice that in our DATA segments, you can specify -SUPPORTEDCOMMANDS &#8211; this gives you the ability to specify a DSV.&nbsp;&nbsp; Yummmmmm!&nbsp; <\/P>\n<P>People have no idea of the power and flexibility that they are going to get with PowerShell V2.&nbsp; It is going to be awesome!<\/P>\n<P>&nbsp;BTW &#8211; I went to Martin and Neil&#8217;s talks and they are super smart guys and I highly recommend going to any talk they give.&nbsp; Great stuff.&nbsp; Truly enjoyable.&nbsp; I didn&#8217;t agree with it all (as you&#8217;ll see from the interview) but it was all worth listening to.<\/P>\n<P>Jeffrey Snover [MSFT]<BR>Windows Management Partner Architect<BR>Visit the Windows PowerShell Team blog at:&nbsp;&nbsp;&nbsp; <A href=\"http:\/\/blogs.msdn.com\/PowerShell\">http:\/\/blogs.msdn.com\/PowerShell<\/A><BR>Visit the Windows PowerShell ScriptCenter at:&nbsp; <A href=\"http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx\">http:\/\/www.microsoft.com\/technet\/scriptcenter\/hubs\/msh.mspx<\/A><BR><\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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).&nbsp; Channel 9 videotaped that discussion and you can watch it HERE. I&#8217;m quite passionate about DSLs &#8211; both FOR them and AGAINST them.&nbsp; The details matter! I have this [&hellip;]<\/p>\n","protected":false},"author":600,"featured_media":13641,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-17882","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"blog_post_summary":"<p>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).&nbsp; Channel 9 videotaped that discussion and you can watch it HERE. I&#8217;m quite passionate about DSLs &#8211; both FOR them and AGAINST them.&nbsp; The details matter! I have this [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/users\/600"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/comments?post=17882"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/posts\/17882\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media\/13641"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/media?parent=17882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/categories?post=17882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/powershell\/wp-json\/wp\/v2\/tags?post=17882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}