<?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; Model Mismatch</title>
	<atom:link href="http://sadekdrobi.com/category/model-mismatch/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>Data, Context and Interaction : a new architectural approach by James O. Coplien and Trygve Reenskaug</title>
		<link>http://sadekdrobi.com/2009/05/08/data-context-and-interaction-a-new-architectural-approach-by-james-o-coplien-and-trygve-reenskaug/</link>
		<comments>http://sadekdrobi.com/2009/05/08/data-context-and-interaction-a-new-architectural-approach-by-james-o-coplien-and-trygve-reenskaug/#comments</comments>
		<pubDate>Fri, 08 May 2009 14:48:01 +0000</pubDate>
		<dc:creator>Sadache</dc:creator>
				<category><![CDATA[Agile Programming]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Model Mismatch]]></category>
		<category><![CDATA[Multi-Paradigm Design]]></category>
		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://sadekdrobi.com/2009/05/08/data-context-and-interaction-a-new-architectural-approach-by-james-o-coplien-and-trygve-reenskaug/</guid>
		<description><![CDATA[James O. Coplien and Trygve Reenskaug have recently introduced a new architectural approach to OOP based on Data, Context and Interaction pattern. It should allow capturing user mental model in terms of behavioral requirements, something that classic OOP fails to do. The article, that triggered many reactions and critics, provides insights into DCI using concrete [...]]]></description>
			<content:encoded><![CDATA[<p>James O. Coplien and Trygve Reenskaug have recently introduced a new architectural approach to OOP based on Data, Context and Interaction pattern. It should allow capturing user mental model in terms of behavioral requirements, something that classic OOP fails to do. The article, that triggered many reactions and critics, provides insights into DCI using concrete examples to show its advantages.</p>
<p><span id="more-606"></span>
<p><a href="http://www.infoq.com/news/2009/05/dci-coplien-reenskau">http://www.infoq.com/news/2009/05/dci-coplien-reenskau</a></p>
]]></content:encoded>
			<wfw:commentRss>http://sadekdrobi.com/2009/05/08/data-context-and-interaction-a-new-architectural-approach-by-james-o-coplien-and-trygve-reenskaug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>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>
	</channel>
</rss>

