<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sadek Drobi's Blog &#187; DSL</title>
	<atom:link href="http://sadekdrobi.com/category/dsl/feed/" rel="self" type="application/rss+xml" />
	<link>http://sadekdrobi.com</link>
	<description>Sadek Drobi</description>
	<lastBuildDate>Tue, 08 Mar 2011 22:56:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Abstraction for People: Configurations, Patterns, DSLs and Monads</title>
		<link>http://sadekdrobi.com/2009/03/29/abstraction-for-people-configurations-patterns-dsls-and-monads/</link>
		<comments>http://sadekdrobi.com/2009/03/29/abstraction-for-people-configurations-patterns-dsls-and-monads/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 23:10:53 +0000</pubDate>
		<dc:creator>Sadache</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[DOTNET]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[LinQ]]></category>
		<category><![CDATA[Model Mismatch]]></category>
		<category><![CDATA[Paradigm Oriented Programming Language]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Useability]]></category>

		<guid isPermaLink="false">http://sadekdrobi.com/2009/03/29/abstraction-for-people-configurations-patterns-dsls-and-monads/</guid>
		<description><![CDATA[

LinQ is often understood in terms of introducing a Domain Specific Language to work with data to C# and .Net in general. The fact is:it is not, and there is a considerable difference between LinQ syntax nature and a DSL. The problem is that DSL definition is blur enough to take anything interesting or cool [...]]]></description>
			<content:encoded><![CDATA[</p>
<p><a href="http://sadekdrobi.com/wp-content/uploads/2009/03/dsc-2692a3.jpg"><img style="border-right-width: 0px; margin: 0px 20px 0px 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="DSC_2692a3" align="left" src="http://sadekdrobi.com/wp-content/uploads/2009/03/dsc-2692a3-thumb.jpg" width="222" height="327"></a></p>
<p>LinQ is often understood in terms of introducing a Domain Specific Language to work with data to C# and .Net in general. The fact is:it is not, and there is a considerable difference between LinQ syntax nature and a DSL. The problem is that DSL definition is blur enough to take anything interesting or cool under it!</p>
<p><span id="more-596"></span>
<p>Back to the beginning. When faced to doing software for a business that has some moving parts, a good practice is to make a generalization or an abstraction of the fixed part and express what is moving through some sort of configurations. That is in some respect what most of enterprise frameworks do when implementing the fixed part and letting you nicely only express what varies for your context. This way you are almost only concerned about your part since the framework itself is supposed to be steady and well abstracted and as a result implicit in your context. This experience hasn&#8217;t been nice enough when XML used to be involved. As someone that defends multi-paradigm design I could argue that XML can play a best fit in some contexts but this is out of the scope of this post. XML charset is not optimal for a lot of cases, so why not creating our own charset, and here comes DSLs.</p>
<p>Of course here I am only talking about the rise of DSLs in the enterprise and not the DSLs that FP been doing for ages, and I&#8217;ll get back to this one later.</p>
<p>Now using my favorite meta magical super dynamic language, I&#8217;d like to construct my customized embedded(or internal) domain specific language, and I&#8217;ll make my best to be English like/business like/ host language unlike to be really specific. And that is where my brains blocks! How can I get grasp of that thing, that &#8216;lil&#8217; language? It might be a personal problem I have because of the nature of my profession as a consultant: I switch contexts often, and&#8230; well I can only hope that it is 1:designed, 2: designed considering practices, rules and well established&#8230; did I say patterns?</p>
<p>&nbsp;</p>
<h3>P for Patterns :</h3>
<p>Another way of providing a solution to the problem of generality/variability is use a catalogue of non-formal generalization of recurring solutions to recurrent problems that provide a rich knowledge base of experience about tackling the kind of problem. Being of non-formal nature means that patterns aren&#8217;t provided as a framework but rather as a set of vocabulary and description that has its power in being adaptive&nbsp; and flexible. In my own experience, what I found particularly interesting when working with code that uses patterns is the way they communicate intent. If I find &#8220;Strategy&#8221; postfix I start searching for the other parts of the patterns and then start building on that. Providing this shared vocabulary helps me getting operational quite fast and help me scan code faster in a more &#8220;visual&#8221; way.</p>
<p>The good thing also about patterns is that I am still playing under the rules of my preferred hosting language. I know very well doing two very important things with it: combining and abstraction. A programming language is a set primitives together with a way to combine them and a mechanism for abstraction. What about my lil DSL? well it depends&#8230; Did I make sure to break any host language logic in there? Did I fight the intuitive nice &#8220;.&#8221;? Or did I decide that to implement my DSL for scratch? A programming language without means of abstraction results inevitably in long flat copy/paste configurations files and please don&#8217;t argue with me about their maintainability. What is the problem? The problem is that I am not a programming language designer, and to create a programming language no matter how simple and small it is, you need to have programming language design skills, so do you?</p>
<h3>Abstraction and Communication for People:</h3>
<p>Something that really drew my attention in functional programming languages like Haskell is their solid formal abstractions used for expressing computational patterns. These abstractions are packaged into a framework, and have a clear identity defined by a set of rules and are useable whenever semantics match. Take monads for example. It doesn&#8217;t matter if you are working with state, a database, the web, the screen or a robitic arm: you just use the do notation. The do notation in Haskell is a convenient way of working with a sound abstraction that is <a href="http://en.wikipedia.org/wiki/Monads_in_functional_programming">THE MONAD</a>. And all what you need to do for your framework is to verify that you satisfy the Monad laws and then you can safely use that syntax for it. This sharing of well identified semantics of the abstraction help developers reuse a well established mental model. LinQ syntax is the same, the dot &#8220;.&#8221; operator is the same, F#&#8217;s&nbsp; &#8220;|&gt;&#8221; operator is the same and examples are a lot. And I tend to prefer these kind of abstractions as they don&#8217;t sacrifice readability for developers for &#8220;readability&#8221; for users. I guess they have both the communicative property of Design Patterns yet they are formal and are offered as a concrete framework. Then of course you can name them DSLs, if you insist :) .</p>
<p>Now, if you are from the functional programming camp, and you have been doing embedded domain specific language using Lisp or Haskell for long time, then I apologize for wasting your time. I know you guys know best about doing abstractions, and you have lessons to tell if we&#8217;d only listen. And for those interested in some examples in EDSLs from the functional world, <a href="http://www.amazon.com/Haskell-School-Expression-Functional-Programming/dp/0521644089/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1238371080&amp;sr=1-1">Paul Hudak goes through the design of a language for reactive animation in his book</a>, <a href="http://augustss.blogspot.com/">Lennart Augustsson</a> discussed EDSLs in Haskell on his blog.</p>
<h3>Conclusion</h3>
<p>Though an attractive option of abstraction, DSLs trade off readability for developers for &#8220;potential&#8221; readability of users. Haskell monads, F#&#8217;s &#8220;|&gt;&#8221; operator and LinQ are examples of sound formal abstraction that can be offered as frameworks (code). These abstractions can save developers time being in a form of a recurring pattern that can be used in different contexts that match semantically, thus reusing developers&#8217; understanding of the abstraction&#8217;s mental model. </p>
]]></content:encoded>
			<wfw:commentRss>http://sadekdrobi.com/2009/03/29/abstraction-for-people-configurations-patterns-dsls-and-monads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Erik Mejier: LinQ, Beyond List Comprehensions in C# and .Net</title>
		<link>http://sadekdrobi.com/2009/03/05/erik-mejier-linq-beyond-list-comprehensions-in-c-and-net/</link>
		<comments>http://sadekdrobi.com/2009/03/05/erik-mejier-linq-beyond-list-comprehensions-in-c-and-net/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 21:55:53 +0000</pubDate>
		<dc:creator>Sadache</dc:creator>
				<category><![CDATA[DOTNET]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[InfoQ]]></category>
		<category><![CDATA[LinQ]]></category>

		<guid isPermaLink="false">http://sadekdrobi.com/2009/03/05/erik-mejier-linq-beyond-list-comprehensions-in-c-and-net/</guid>
		<description><![CDATA[Erik Meijer talks about less known LINQ features, like meta programming, about the differences between functional languages and OO ones, asynchronous computation, and others.

http://www.infoq.com/interviews/LINQ-Erik-Meijer
]]></description>
			<content:encoded><![CDATA[<p>Erik Meijer talks about less known LINQ features, like meta programming, about the differences between functional languages and OO ones, asynchronous computation, and others.</p>
<p><span id="more-591"></span></p>
<p><a href="http://www.infoq.com/interviews/LINQ-Erik-Meijer">http://www.infoq.com/interviews/LINQ-Erik-Meijer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sadekdrobi.com/2009/03/05/erik-mejier-linq-beyond-list-comprehensions-in-c-and-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quiz:: SharpLight &#124;&gt; What does this do?</title>
		<link>http://sadekdrobi.com/2009/02/03/quiz-sharplight-what-does-this-do/</link>
		<comments>http://sadekdrobi.com/2009/02/03/quiz-sharplight-what-does-this-do/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 14:02:09 +0000</pubDate>
		<dc:creator>Sadache</dc:creator>
				<category><![CDATA[Agile Programming]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[DOTNET]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[sharplight]]></category>

		<guid isPermaLink="false">http://sadekdrobi.com/2009/02/03/quiz-sharplight-what-does-this-do/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><a href="http://sadekdrobi.com/wp-content/uploads/2009/02/combination1.jpg"><img style="border-bottom: 0px; border-left: 0px; border-top: 0px; border-right: 0px" border="0" alt="combination" src="http://sadekdrobi.com/wp-content/uploads/2009/02/combination-thumb1.jpg" width="627" height="105" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://sadekdrobi.com/2009/02/03/quiz-sharplight-what-does-this-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quizz:: SharpLight &#124;&gt; What does this do?</title>
		<link>http://sadekdrobi.com/2009/01/19/quizz-sharplight-what-does-this-do/</link>
		<comments>http://sadekdrobi.com/2009/01/19/quizz-sharplight-what-does-this-do/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 10:40:58 +0000</pubDate>
		<dc:creator>Sadache</dc:creator>
				<category><![CDATA[DOTNET]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[sharplight]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://sadekdrobi.com/2009/01/19/quizz-sharplight-what-does-this-do/</guid>
		<description><![CDATA[div &#60;&#60;   &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; a &#34;sadekdrobi.com&#34;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#60;&#60; img &#34;http://is.gd/gqVX&#34;    &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ++ &#34;my lil&#8217; friend&#34;
]]></description>
			<content:encoded><![CDATA[<p>div &lt;&lt;   <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; a &quot;sadekdrobi.com&quot;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;&lt; img &quot;<a title="http://is.gd/gqVX" href="http://is.gd/gqVX">http://is.gd/gqVX</a>&quot;    <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ++ &quot;my lil&#8217; friend&quot;</p>
]]></content:encoded>
			<wfw:commentRss>http://sadekdrobi.com/2009/01/19/quizz-sharplight-what-does-this-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>External DSLs: Success and Failure Factors</title>
		<link>http://sadekdrobi.com/2008/12/07/external-dsls-success-and-failure-factors/</link>
		<comments>http://sadekdrobi.com/2008/12/07/external-dsls-success-and-failure-factors/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 21:31:31 +0000</pubDate>
		<dc:creator>Sadache</dc:creator>
				<category><![CDATA[DSL]]></category>

		<guid isPermaLink="false">http://sadekdrobi.com/2008/12/07/external-dsls-success-and-failure-factors/</guid>
		<description><![CDATA[Given the growing interest in Domain Specific Languages, Michael Feathers provides some reflections on external DSLs, their advantages and pitfalls as well as possible success and failure factors that he believes to be function of far more than the technology.


Originally posted on http://www.infoq.com/news/2008/12/external-dsl-advantages-pitfalls
Given the growing interest in Domain Specific Languages (DSLs), Michael Feathers provides some [...]]]></description>
			<content:encoded><![CDATA[<p>Given the growing interest in Domain Specific Languages, Michael Feathers provides some reflections on external DSLs, their advantages and pitfalls as well as possible success and failure factors that he believes to be function of far more than the technology.</p>
<p><span id="more-547"></span></p>
<p>
<p>Originally posted on <a title="http://www.infoq.com/news/2008/12/external-dsl-advantages-pitfalls" href="http://www.infoq.com/news/2008/12/external-dsl-advantages-pitfalls">http://www.infoq.com/news/2008/12/external-dsl-advantages-pitfalls</a>
<p>Given <a href="http://www.infoq.com/dsl">the growing interest in Domain Specific Languages</a> (DSLs), Michael Feathers provides <a href="http://michaelfeathers.typepad.com/michael_feathers_blog/2008/11/how-to-fail-with-external-dsls.html">some reflections on external DSLs</a>, their advantages and pitfalls as well as possible success and failure factors. He stresses that while external DSLs â€œgive you a freer hand Â» and allow you creating Â« a complete syntax and tune it directly to a particular domainâ€, they represent an important commitment for companies using them. And this â€œcommitment doesnâ€™t end when the initial implementation is doneâ€.&nbsp;
<p>Because of the specificity of external DSLs, they may induce significant maintenance costs since there should be in-house expertise for adapting DSL to occurring changes. For the same reason, the use of external DSLs complicates hiring and, more specifically, hiring of domain experts:<br />
<blockquote>
<p>Letâ€™s face it, if you are looking for a job what do you want to have on your resume?&nbsp; A language used by precisely one company or one that is known or used throughout the industry? [â€¦]
<p>One very public example is Erlang.&nbsp; People are paying a lot of attention to Erlang today, but we shouldnâ€™t forget that it was dropped by Ericsson in part because they were concerned with their ability to hire and train developers.&nbsp; Many people know the story of Erlang, but what they donâ€™t realize is just how common this scenario has been in the industry.&nbsp; I get to see a lot of legacy code in my work, and a good amount of it is in homegrown languages that companies have trouble supporting.</p>
</blockquote>
<p>So, Michael Feathers argues that, with regard to external DSLs, â€œsuccess is a function of far more than the technologyâ€. Their potential can only be successfully exploited if company objectively assesses the needed commitment and can assume it â€œeven under adverse business conditionsâ€. In addition to that, Feathers outlines a couple of ideas about how to reduce potential costs of external DSLs:
<ol>
<ol>
<li>If you are creating an external DSL, consider open sourcing it or, at least, consider forming some sort of an industry group around it.&nbsp; This partially externalizes the cost of maintenance and avoids hiring trouble.&nbsp;
<li>If you canâ€™t or wonâ€™t open your DSL(s) to the outside world, make sure that your developers are not expected to use them exclusively.&nbsp; If you donâ€™t, you can expect to pay higher wages for developers of equivalent skill than you would otherwise.&nbsp; In negotiations, they will factor in the cost of working with little known technologies. </li>
</ol>
</ol>
<p>Considering embedded DSLs could be another alternative since, according to the author, they are easy to construct and can yield many of the same advantages as external DSLs.&nbsp; </p>
]]></content:encoded>
			<wfw:commentRss>http://sadekdrobi.com/2008/12/07/external-dsls-success-and-failure-factors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RefX:: ORMs, Relational Data, Mismatch, LinQ and DSLs</title>
		<link>http://sadekdrobi.com/2008/11/10/refx-orms-relational-data-mismatch-linq-and-dsls/</link>
		<comments>http://sadekdrobi.com/2008/11/10/refx-orms-relational-data-mismatch-linq-and-dsls/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 02:42:22 +0000</pubDate>
		<dc:creator>Sadache</dc:creator>
				<category><![CDATA[Agile in the Enterprise]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[D90]]></category>
		<category><![CDATA[DOTNET]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[Domain Driven Design]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[LinQ]]></category>
		<category><![CDATA[Mapping]]></category>
		<category><![CDATA[Model Mismatch]]></category>
		<category><![CDATA[Multi-Paradigm Design]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[Polyglot Programming]]></category>
		<category><![CDATA[Productivity]]></category>

		<guid isPermaLink="false">http://sadekdrobi.com/2008/11/10/refx-orms-relational-data-mismatch-linq-and-dsls/</guid>
		<description><![CDATA[   
Having worked with several Object-Relational mapping frameworks in the last few years, I got to a point where I couldn&#8217;t justify their complexity in my project. We often talk about the mismatch between the database and the object worlds, and that is where ORMs are often stated and referenced for &#8220;bridging the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sadekdrobi.com/wp-content/uploads/2008/11/raw000781.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="361" alt="Raw00078" src="http://sadekdrobi.com/wp-content/uploads/2008/11/raw00078-thumb1.jpg" width="534" border="0"></a> <a href="http://sadekdrobi.com/wp-content/uploads/2008/11/raw001701.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="379" alt="Raw00170" src="http://sadekdrobi.com/wp-content/uploads/2008/11/raw00170-thumb1.jpg" width="258" border="0"></a> <a href="http://sadekdrobi.com/wp-content/uploads/2008/11/dsc-01911.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="378" alt="DSC_0191" src="http://sadekdrobi.com/wp-content/uploads/2008/11/dsc-0191-thumb1.jpg" width="257" border="0"></a> </p>
<p>Having worked with several Object-Relational mapping frameworks in the last few years, I got to a point where I couldn&#8217;t justify their complexity in my project. We often talk about the mismatch between the database and the object worlds, and that is where ORMs are often stated and referenced for &#8220;bridging the gap&#8221;!</p>
<p>Well I prefer to call it lifting the gap, or highering the gap, to have it now between DAOs and the rest of the code than having it between database and code.But I wouldn&#8217;t call this in any way reducing the gap.</p>
<p><span id="more-538"></span></p>
<p>First thing to mention here, is that data structures are not evil. We often deal with XML data structure but we absolutely refuse to deal with relational data structures. The problem might be related to time, XML came with a whole arsenal of managed APIs that represent its model in a way that makes it more comfortable for you to manipulate these documents. All together with transformation APIs that made it a lot easier to fill your object model out of an XML. Relational data structure on the other hand did not have the luxury of standard APIs and representation models in mainstream languages, and that made dealing with a database request result so arbitrary (Datasets existed in .Net but they have been cursed heavily and has been forced out of the cool toolbox, do not know yet why!) .&nbsp; </p>
<p>In some way, I guess that the &#8220;mismatch&#8221; between Relational data structures and objects exists much similarly between XML and objects, however we didn&#8217;t think for so long of a doing a mapping between XML and object OXM? (no we are starting to do so, writing some XML to map XML to objects!).</p>
<p>With the experience I had with mapping technologies, I can say that they do not solve the problem for me. They merely add yet another useless level of abstraction where your domain types look nothing like relational data structures, but yet nothing like your target domain model! They have gone a half way, and now its your turn to poison your application with a lot of absurd ORM code trying to stretch this bridge to reduce the gap&#8230; </p>
<p>Geeks love talking about intrusivty of an ORMs and compare level of intrusivty in different terms. Intrusivty is much more than the lack of an interface or methods to implement in your domain objects. I guess I am ok to deal with that kind of intrusivity. However all ORMs I tried do not give me the opportunity to express my domain model in the way I would like to. I have to deal with notions of Lazy Loading, Attached/Detached entities, Entity sets, ids, back fields and a lot of other things that I don&#8217;t want to appear in my model and that make the resulting code so ugly and complex that I don&#8217;t wish to visit soon.</p>
<p>As Bob Martin said before, we are missing the opportunity to do oop, I would enforce and say we are missing the opportunity to model at all. And I guess we have gone too far with ORMs and it is time to go back to the basics, in the same way we have done after the EJB great abstraction.</p>
<p>It is very contradictory, while we are so excited about DSLs and the goodness they can potentially bring to enterprise development that results in a declarative semanticful style of programming, we can&#8217;t help but to engage all of our means in trying to bury SQL (and effective, semanticful, declarative powerful domain specific language) behind a dumb API to &#8220;abstract database access&#8221;! I guess we got to chose one strategy, either we keep SQL and we&nbsp; keep marketing DSLs or we hope for a new advanced GPL compiler that will hide all of this in the same way modern languages did with garbage collection, concurrency and synchronization.</p>
<p>Since I am not yet a compiler writer, and I aint got around an effective way of integrating database in mainstream languages (there is actually a very productive in memory database on Haskell that worth trying), I decide to keep the DSL, and to work with them without the need to hide them, but rather to get a better tooling to help converting between difference data structures.</p>
<p>I guess you&#8217;ve guessed it by now. For me LinQ is the mid-term solution for the data structure mismatch. No not LinQ to sql, nor Ado.Net entities (they are helpful and we might use them but lets focus on the solution). LinQ is a very productive tool that halps effectively transform anything to anything in few lines of code. I mean that I can still use powerful SQL to get data effeciently and then convert them with one line of LinQ into the destination data structure. No abstraction leak, less complexity: Use the right tool where it applies. </p>
<p>So what I would actually do is to use a framework that will execute my SQL or SQL like query on the database and get me the records in much the same way they are in the database,Much in the same way Active Record gets you records as they are in the database. No useless efforts from the framework to bend the data to make it look untruthfully like the destination model.&nbsp; I guess I know better my domain model, and with this better tooling I can get it done with no problem.</p>
<p>&nbsp;</p>
<div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f663d4e1-de43-4d9c-9f89-7b45ec5b5a86" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px">Mots clÃ©s Technorati : <a href="http://technorati.com/tags/mapping" rel="tag">mapping</a>,<a href="http://technorati.com/tags/orm" rel="tag">orm</a>,<a href="http://technorati.com/tags/linq" rel="tag">linq</a>,<a href="http://technorati.com/tags/mismatch" rel="tag">mismatch</a>,<a href="http://technorati.com/tags/relational.%20data%20structure" rel="tag">relational. data structure</a>,<a href="http://technorati.com/tags/abstraction" rel="tag">abstraction</a>,<a href="http://technorati.com/tags/domain%20model" rel="tag">domain model</a>,<a href="http://technorati.com/tags/deseign" rel="tag">deseign</a></div>
]]></content:encoded>
			<wfw:commentRss>http://sadekdrobi.com/2008/11/10/refx-orms-relational-data-mismatch-linq-and-dsls/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ted Neward on Present and Past Languages</title>
		<link>http://sadekdrobi.com/2008/10/28/ted-neward-on-present-and-past-languages/</link>
		<comments>http://sadekdrobi.com/2008/10/28/ted-neward-on-present-and-past-languages/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 13:28:58 +0000</pubDate>
		<dc:creator>Sadache</dc:creator>
				<category><![CDATA[Conferences]]></category>
		<category><![CDATA[DOTNET]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[InfoQ]]></category>
		<category><![CDATA[JVM]]></category>
		<category><![CDATA[LinQ]]></category>
		<category><![CDATA[Polyglot Programming]]></category>

		<guid isPermaLink="false">http://sadekdrobi.com/2008/10/28/ted-neward-on-present-and-past-languages/</guid>
		<description><![CDATA[This is an interview I did at QCon with Ted Neward. Talking to Ted was very interesting even though arguing with him turned to be not easy at all :)
]]></description>
			<content:encoded><![CDATA[<p>This is <a href="http://www.infoq.com/interviews/Languages-Ted-Neward">an interview I did at QCon with Ted Neward</a>. Talking to <a href="http://blogs.tedneward.com/">Ted</a> was very interesting even though arguing with him turned to be not easy at all :)</p>
]]></content:encoded>
			<wfw:commentRss>http://sadekdrobi.com/2008/10/28/ted-neward-on-present-and-past-languages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>And Design Patterns suddenly Degrade!</title>
		<link>http://sadekdrobi.com/2008/04/20/and-design-patterns-suddenly-degrade/</link>
		<comments>http://sadekdrobi.com/2008/04/20/and-design-patterns-suddenly-degrade/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 21:25:06 +0000</pubDate>
		<dc:creator>Sadache</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[Functional Programming]]></category>
		<category><![CDATA[Haskell]]></category>
		<category><![CDATA[LinQ]]></category>

		<guid isPermaLink="false">http://sadekdrobi.com/2008/04/20/and-design-patterns-suddenly-degrade/</guid>
		<description><![CDATA[Lately I&#8217;ve been writing some programs with Haskell (a pure functional programming language) and I noticed that I am not using GoF design patterns anymore, and that got me to a question: What are GoF design patterns? And why do we need them?
This actually reminds me of a good definition I read (I can&#8217;t recall [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been writing some programs with Haskell (a pure functional programming language) and I noticed that I am not using GoF design patterns anymore, and that got me to a question: What are GoF design patterns? And why do we need them?</p>
<p>This actually reminds me of a good definition I read (I can&#8217;t recall where) of these design patterns: Resolutions to programming language limitations implemented using the programming language available syntax. When one learns a programming language, he learns to express what he wants to express using a very limited set of expressions of the language. The problem with this is that his imagination in this environment gets boxed! So what are GoF design patterns?</p>
<p>Most of GoF design patterns are inspired from Smaltalk, so what is so special about Smaltalk? Closures! It turns out that Java and C++ didn&#8217;t have closures and higher order functions. Some of the Design Patterns came to rescue and provide &quot;alternatives&quot; to these powerful constructs or workarounds&#160; to resolve these limitations. Such an approach requires a kind of object gymnastics and results in an explosion of classes!</p>
<p>I am now on a project where I use C# 3.5 features, and guess what? Suddenly I use much less strategies, much less templates. I write much less code yet being as or even more flexible. Powerful lambda expressions!</p>
<p>Update: DSLs also come from fp paradigm!</p>
]]></content:encoded>
			<wfw:commentRss>http://sadekdrobi.com/2008/04/20/and-design-patterns-suddenly-degrade/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Insights: You don&#8217;t need your DSL to be English-like</title>
		<link>http://sadekdrobi.com/2008/03/28/insights-you-dont-need-your-dsl-to-be-english-like/</link>
		<comments>http://sadekdrobi.com/2008/03/28/insights-you-dont-need-your-dsl-to-be-english-like/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 19:49:13 +0000</pubDate>
		<dc:creator>Sadache</dc:creator>
				<category><![CDATA[Agile Programming]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[Domain Driven Design]]></category>
		<category><![CDATA[Useability]]></category>

		<guid isPermaLink="false">http://sadekdrobi.com/2008/03/28/insights-you-dont-need-your-dsl-to-be-english-like/</guid>
		<description><![CDATA[There is a widespread opinion that a good DSL has to be English-like. Dave Thomas advocates against such approach asserting that DSL are not about getting as close as possible to natural languages and that having this as a guiding principle of DSL design can be rather detrimental. He also highlights what he believes is [...]]]></description>
			<content:encoded><![CDATA[<p>There is a widespread opinion that a good DSL has to be English-like. Dave Thomas advocates against such approach asserting that DSL are not about getting as close as possible to natural languages and that having this as a guiding principle of DSL design can be rather detrimental. He also highlights what he believes is important in DSL design and provides some examples of successful DSL.</p>
<p><span id="more-459"></span></p>
<p><a title="http://www.infoq.com/news/2008/03/dsls-are-not-natural-languages" href="http://www.infoq.com/news/2008/03/dsls-are-not-natural-languages">http://www.infoq.com/news/2008/03/dsls-are-not-natural-languages</a></p>
<p>There is a widespread opinion that a good DSL has to be English-like in order to be readable for non-programmers. Dave Thomas advocates against such approach asserting that <a href="http://pragdave.blogs.pragprog.com/pragdave/2008/03/the-language-in.html">DSL are not about getting as close as possible to natural languages</a>. Moreover, he argues that having this as a guiding principle of DSL design can be rather detrimental. He also highlights what he believes is important in DSL design and provides some examples of successful DSL that do not necessarily reed like English. </p>
<p>According to Dave, DSL don&#8217;t need to be close to English or any other natural language because they targets a very specific category or users &#8211; domain experts &#8211; who actually don&#8217;t speak a natural language</p>
<blockquote><p>Domain experts [&#8230;] are speaking jargon, a specialized language that they&#8217;ve invented as a shorthand for communicating effectively with their peers. Jargon may use English words, but these words have been warped into having very different meanings&#8212;meanings that you only learn through experience in the field.</p>
</blockquote>
<p>Hence, DSL should reflect this jargon and express the expertise of domain specialists in a concise way. Make for dependency management, Groovy builders for expressing data in code and Active record declaration for data modeling in Ruby are a few successful examples of such DSL that respond to domain experts needs without necessarily being English-like. Even though some statements in Active record declaration may look like English, e.g. has_many or belongs_to, they actually are not: &#8220;they are jargon from the world of modeling&#8221; and &#8220;they have a specific meaning in that context.&#8221;</p>
<p>Another important point raised by Dave is that, in his opinion, &#8220;domain experts&#8221; should not be understood as business users but rather as people who are writing specs. These people are programmers. They do not really need an English-like language. Dave actually believes that the notion of fluent interface is often misunderstood: &#8220;the fluency here is programmer fluency, not English fluency. It&#8217;s writing succinct, expressive code&#8221;. </p>
<p>Dave Thomas argues that not only isn&#8217;t it necessary trying to get closer to a natural language, but it can also be detrimental. Natural languages are imprecise. This makes their power in the real world but this cannot apply to programming. This is why, &#8220;whenever we try to create a DSL that looks like a natural language, we fall short&#8221;. However hard one tries, syntax tends to remain &#8220;very unEnglish like&#8221;. And this gap is rather confusing: </p>
<blockquote><p>There&#8217;s a major cognitive dissonance&#8212;I have to take ideas expressed in a natural language (the problem), then map them into an artificial language (the AppleScript programming model), but then write something that is a kind of faux natural language.</p>
</blockquote>
<p>To illustrate the possible confusion, Dave gives an example of piece code from a test written using the test/spec framework and analyses one expression: </p>
<p><em>@result.should.be.a.kind.of String</em></p>
<blockquote><p>It reads like English. But it isn&#8217;t. The words are separated by periods, except the last two, where we have a space. As a programmer, I know why. But as a user, I worry about it. In the first example, we write @result.should.be.a.kind_of. Why not kind.of? If I want to test that floats are roughly equal, I&#8217;d have said @result.should.be.close value. Why not close.to value? </p>
<p>Trivial details, but it means that I can&#8217;t just write tests using my knowledge of English&#8212;I have to look things up. And if I have to do that, why not just use a language/API that is closer to the domain of specifications and testing?</p>
</blockquote>
<p>It is true that English-like DSL may be more readable, but Dave argues that &#8220;the attempt to create a natural language feel in the DSL leads to all sorts of leaks in the abstraction&#8221;. It might add to readability of code but it would &#8220;be taking away from its writability&#8221; and &#8220;adding uncertainty and ambiguity&#8221;: </p>
<blockquote><p>The second you find yourself writing </p>
</p>
<p>&#160; <em>def a       <br />&#160;&#160;&#160;&#160; self        <br />&#160; end</em></p>
</p>
<p>so that you can use &quot;a&quot; as a connector in </p>
</p>
<p><em>add.a.diary.entry.for(&quot;Lunch&quot;).for(August.10.at(3.pm))</em></p>
</p>
<p>you know you&#8217;ve crossed a line. This is not longer a DSL. It&#8217;s broken English. </p>
</blockquote>
<p>One of commentators, Has, also believes that trying to make a language readable to non-programmers one risks to end up with a &quot;read-only language&#8221;. He takes the example of AppleScript. To improve its readability, it was necessary to remove &#8220;most of the usual symbolic cues that describe a language&#8217;s semantics&#8221;. As a result, &#8220;the syntax effectively obfuscates, not clarifies, the language semantics&#8221;. If &#8220;it&#8217;s very easy to read an AppleScript and understand _what_ it does, it&#8217;s damnably hard to figure out exactly _how_ it does it&#8221;. </p>
<p>Has highlights another issue that may result from using an English-like DSL: users might assume that &#8220;because it _looks_ like English, it will also _behave_ like it&#8221; and &#8220;form all sorts of very strong associations and conclusions about its nature, which then have to be undone the long, hard way&#8221;. Hence, according to Has, English-like appearance &#8220;accidentally encourages unrealistic user assumptions&#8221;</p>
<p>If DSL readability and expressiveness are of interest for you, find more examples and comments on <a href="http://pragdave.blogs.pragprog.com/pragdave/2008/03/the-language-in.html">Dave&#8217;s blog post</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://sadekdrobi.com/2008/03/28/insights-you-dont-need-your-dsl-to-be-english-like/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Refex:: Does code become better as it approaches English?</title>
		<link>http://sadekdrobi.com/2008/01/18/refex-does-code-become-better-as-it-approaches-english/</link>
		<comments>http://sadekdrobi.com/2008/01/18/refex-does-code-become-better-as-it-approaches-english/#comments</comments>
		<pubDate>Fri, 18 Jan 2008 17:50:58 +0000</pubDate>
		<dc:creator>Sadache</dc:creator>
				<category><![CDATA[Agile Programming]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[DSL]]></category>

		<guid isPermaLink="false">http://sadekdrobi.com/2008/01/18/refex-does-code-become-better-as-it-approaches-english/</guid>
		<description><![CDATA[Achieving readability and expressiveness by writing English-like code is one of the trends on the rise in today&#8217;s industry. Michael Feathers advocates for considering other alternatives that can be instrumental for improving code expressiveness. He argues that in some circumstances symbolic approach is more appropriate than the narrative one and highlights some trades-offs between them. [...]]]></description>
			<content:encoded><![CDATA[<p>Achieving readability and expressiveness by writing English-like code is one of the trends on the rise in today&#8217;s industry. Michael Feathers advocates for considering other alternatives that can be instrumental for improving code expressiveness. He argues that in some circumstances symbolic approach is more appropriate than the narrative one and highlights some trades-offs between them. </p>
<p><span id="more-446"></span></p>
<p>&#160;</p>
<p><a title="http://www.infoq.com/news/2008/01/narrative-vs-symbolic-code" href="http://www.infoq.com/news/2008/01/narrative-vs-symbolic-code">http://www.infoq.com/news/2008/01/narrative-vs-symbolic-code</a></p>
<p>Achieving readability and expressiveness by writing English-like code is one of the trends on the rise in today&#8217;s industry. This is particularly true for DSL and BDD communities, but many developers working in Java, C# or Ruby also try to make their code look as close to English as possible. </p>
<p>In his article &#8220;The Narrative Urge&#8221;, <a href="http://beautifulcode.oreillynet.com/2008/01/the_narrative_urge_1.php">Michael Feathers challenges the idea that &#8220;code becomes better as it approaches English&#8221;</a>. Expressiveness and readability help improving maintainability and bridging the gap between programmers and business, as it was highlighted by Martin Fowler and Neal Ford in their presentation about DSLs. Michael Feathers does not question that fact. He emphasizes, however, that &#8220;natural language should not be the only direction we explore when we look for expressivity&#8221;. </p>
<p>One should not neglect the fact that there are different ways of understanding the text. Feathers compares narrative and symbolic modes:</p>
<blockquote><p>In the narrative mode, we are approach text like prose and read through it the way we would read through English or any other natural language &#8211; it tickles the verbal centers of our brain. The symbolic mode is more visual.</p>
</blockquote>
<p>Hence, expressiveness can also be yielded by the symbolic approach and Feathers argues that in some circumstances it may be more appropriate than the English-esque one. He outlines a number of trade-offs that might impact the choice between these approaches.</p>
<p>Feathers considers narrative mode to be more appropriate for user facing tools rather than for &#8220;code written by and for developers&#8221;. More importantly, however, the choice depends on the domain specificities. First of all, according to Feathers, it may depend on how &#8220;settled definitions and nomenclature&#8221; even though criteria are not that clear:</p>
<blockquote><p>On the one hand, if you are working in a domain like dates or scientific units, with settled definitions and nomenclature, it can pay to use a natural language style in your API. When definitions are settled, there is less of a chance that the machinery of a DSL will have to be refactored as much over time. On the other hand, once definitions are settled and well understood, you can eliminate a lot of cruft by moving toward a symbolic approach.</p>
</blockquote>
<p>Feathers also highlights that in some domains, it is not easy to give a verbal expression for a task. In this case, symbolic alternative can &#8220;make code comprehension a breeze&#8221; being &#8220;more precise than what we are used to with natural language&#8221;. Feathers further develops this idea in his other post about <a href="http://beautifulcode.oreillynet.com/2008/01/narrative_vs_symbolic_programm.php">trade-offs of narrative vs. symbolic programming</a> . He gives the example of the symbolic approach in an embedded DSL for music composition: </p>
<blockquote><p>funkGroove</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; = let p1 = perc LowTom qn</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; p2 = perc AcousticSnare en</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; in Tempo 3 (Instr Percussion (cut 8 (repeatM</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ((p1 :+: qnr :+: p2 :+: qnr :+: p2 :+:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; p1 :+: p1 :+: qnr :+: p2 :+: enr)</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; :=: roll en (perc ClosedHiHat 2))</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; )))</p>
</blockquote>
<p>According to Feathers, the symbolic mode works well for this specific domain because &#8220;people don&#8217;t talk about how one note follows another as much as they listen for notes or see them on a page.&#8221; More generally speaking, he argues that the symbolic approach is more appropriate for programs that are about structure rather than about semantics for which narrative mode more suited.&#160; </p>
<p>Hence, a certain number of elements should be taken into consideration before chosing English-like code as a means for improving readability and expressiveness. What does your experience tell you about the expressive power of symbolic approach and different trade-offs presented by Michael Feathers?</p>
]]></content:encoded>
			<wfw:commentRss>http://sadekdrobi.com/2008/01/18/refex-does-code-become-better-as-it-approaches-english/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

