﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on Why we need for Domain Specific Languages</title><description>Mats, thanks for asking the hard questions.
  
  
1/ No, it is not just a method signature. How do you import a custom assembly with external code? How do you enter a new namespace?
  
The language doesn't let me make it work.
  
  
I want to do something that is complex, and I want to be able to do that with all my usual tools, so I use C# and compile an assembly
  
And then I can immediately use it like this:
  
  
import Complex from SomeComplex
  
  
if ComplexCalculation(account):
  
   do stuff
  
  
Extensibility of the DSL with external factors is important.
  
  
2/ The point of writing the book is that _you_ will be able to write the DSL easily.
  
  
3/ My claim is that the cost of doing something like this is that you have very low cost for this.
  
I'll try to post a more appropriate example soon.
  
  
4/ There isn't much cost in there, but there is a lot of value in being expressive. There is also more value in being able to actually look at things without the programming language overhead.
  
I don't think that I disagree with that there will be times that an API is good as a DSL, but I think that I have a different idea about where that line is at.
</description><link>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment9</link><guid>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment9</guid><pubDate>Fri, 30 Nov 2007 22:20:15 GMT</pubDate></item><item><title>Mats Helander commented on Why we need for Domain Specific Languages</title><description>1) Just a method signature, which can easily be generated at any point. If we generate it early, we could let the user edit his code snippet inside it in VS, giving IntelliSense, error handling etc. Otherwise we could generate it late, essentially creating a VB/C# scripting environment rather than a "DSL" environment for our users. In both cases, the user would only have to write those lines I showed in the example
  
  
2) Well, this is just what I mean - I'll bet that I can explain that &amp;&amp; means And faster than you can build a new DSL to make that ugliness go away.......hmmm....actually, I take that back. But I'll bet that _you_ can explain it faster than _I_ can build the DSL ;-)
  
  
Seriously, yup it is ugly, but I have the feeling I could solve it with a post-it saying "&amp;&amp; means And, || means Or" instead of building a DSL. I think I would at least ask the customer to decide between these options.
  
  
3) Agreed, but I would argue that you need a certain level of sophistication in your language before you can start exploiting this type of potential with a DSL. Some domains and project scopes definitely warrant this approach, but unless it can be clearly established that this is the case in one's current project, chances are that the overhead involved in developing and supporting a DSL can not be warranted by a potential that may never become used. 
  
  
If the API approach becomes as clear or at least almost as clear for the actual use cases, why not go with it? All I'm saying is that the example you showed looked clearly of the kind where an API would suffice just as well. I'd love to see an example that actually motivated the DSL over the API for a business DSL, because as far as I have seen, those are rare...(though certainly not non-existing)
  
  
4) Indeed, but you can improve the API. I'm not saying that DSLs don't have value, I'm saying that in most cases I have seen, they do not have enough value when compared to an API that it motivates their higher overhead. Better tool support for DSLs would definitely change this equation.
  
  
/Mats
</description><link>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment8</link><guid>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment8</guid><pubDate>Wed, 28 Nov 2007 14:42:31 GMT</pubDate></item><item><title>Ayende Rahien commented on Why we need for Domain Specific Languages</title><description>Several reasons.
  
The first is that the examples that you gave are not stand alone examples, you need to wrap them by quite a bit of syntax to make them work.
  
The second is that the C# ones introduce syntax which is really not fun to explain to the user
  
(&amp;&amp;, what is that?).
  
The third is that instead of introducing language semantics, you introduce operations on API, there is usually a distinct difference between them. The language semantics are meant to be clear, readable and similar to a written language, an API has different design goals.
  
The forth is that while it is not shown in this example, I have a long way to go with the DSL approach, where the VB.Net / C# approach I have no way to improve on the current syntax.
</description><link>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment7</link><guid>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment7</guid><pubDate>Wed, 28 Nov 2007 14:15:07 GMT</pubDate></item><item><title>Mats Helander commented on Why we need for Domain Specific Languages</title><description>Why is this:
  
  
if CallMinutesForCurrentMonth &gt; 300 and HasBenefit “300 Minutes Free!!!”:
  
          AddCallMinutes -300, "300 Minutes Free!!!" 
  
  
so much clearer than this:
  
  
If client.CallMinutesForCurrentMonth &gt; 300 And client.HasBenefit(“300 Minutes Free!!!”) Then
  
          client.AddCallMinutes(-300, "300 Minutes Free!!!")
  
End If
  
  
or even
  
  
if (client.CallMinutesForCurrentMonth &gt; 300 &amp;&amp; client.HasBenefit(“300 Minutes Free!!!”)
  
          client.AddCallMinutes(-300, "300 Minutes Free!!!");
  
  
There's definitely going to be a non-trivial cost involved in developing and supporting a new DSL for the customer.  
  
  
To me it seems that someone who could parse your DSL example could be trained to understand the VB.NET or even the C# example for a much smaller cost than developing a new DSL? 
  
  
/Mats
</description><link>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment6</link><guid>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment6</guid><pubDate>Wed, 28 Nov 2007 14:07:25 GMT</pubDate></item><item><title>John Lopez commented on Why we need for Domain Specific Languages</title><description>SQL is the most used DSL in existance; if one would prefer to use C++ or Java to do what SQL does (hide the complexity of data access from the user) then I think something is probably amiss. Wrapping data access in a low level data access layer and a high level business objects layer of course is a different task, but I think going back to file based data access simply to reject DSLs would represent madness.
  
  
A good DSL does one thing, and does it very well. It should also be easily *wrapped* in a traditional procedural language so that those missing features and irregularities can be handled in a structured way.
  
  
The biggest problem with DSL creation is that often we don't keep it *simple* enough. We try to turn it into a full blown development language with general purpose features that mask the distinction between the tasks that the DSL is designed for, and those that the system's infrastructure should be providing.
  
  
This is where DSLs can fail to provide the value they were intended for, not simply by doing the job they were intended for: partitioning business rules, data access, logic processing and system configuration away from the infrastructure of the core system.
</description><link>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment5</link><guid>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment5</guid><pubDate>Tue, 27 Nov 2007 15:23:58 GMT</pubDate></item><item><title>Ayende Rahien commented on Why we need for Domain Specific Languages</title><description>That is why my DSL language of choice is Boo, it is a CLR language that can integrate cleanly into a bigger application.
</description><link>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment4</link><guid>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment4</guid><pubDate>Tue, 27 Nov 2007 01:11:36 GMT</pubDate></item><item><title>clearlite mike commented on Why we need for Domain Specific Languages</title><description>Frankly, I prefer C++ or Java.
  
  
The problem with DSL's is that inevitably some aspect of the applcation is outside the 'specific domain', even if only a little bit.  Then you either have to jump through many hoops or resort to a 'general puprose' langue anyway.
  
  
I prefer to work with standard and widely used languages, because of tool support and a large body of accumulated experience in the development community.
  
  
These concerns usually outweigh the 'advantages' of some proprietary and narrowly focused 'language' or syntax,  which very often is neither consistent nor complete.
  
  
</description><link>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment3</link><guid>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment3</guid><pubDate>Mon, 26 Nov 2007 22:06:04 GMT</pubDate></item><item><title>Ayende Rahien commented on Why we need for Domain Specific Languages</title><description>Steve,
  
That is a very good point, I never considered it in this sense. Probably because I don't think of this as a DSL.
</description><link>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment2</link><guid>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment2</guid><pubDate>Sun, 25 Nov 2007 17:44:40 GMT</pubDate></item><item><title>The Other Steve commented on Why we need for Domain Specific Languages</title><description>This business DSL stuff you are talking about.  It's been around for years.  It's called a Business Rules Engine.
  
  
Look at iLog for an example.
  
http://www.ilog.com/products/rulesnet/index.cfm
  
  
But there are dozens upon dozens of these out there.
  
</description><link>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment1</link><guid>http://ayende.com/2968/why-we-need-for-domain-specific-languages#comment1</guid><pubDate>Sun, 25 Nov 2007 17:38:29 GMT</pubDate></item></channel></rss>