﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com/blog/</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2012 (c) 2012</copyright><ttl>60</ttl><item><title>DotNetRocks on Domain Specific Languages</title><description>&lt;p&gt;Last week I recorded a DNR session about &lt;a href="http://www.dotnetrocks.com/default.aspx?ShowNum=529"&gt;Domain Specific Languages&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;I also talked just a bit about writing your own DSL, some challenges that I run into since &lt;a href="http://manning.com/rahien/"&gt;the book&lt;/a&gt;, the Boo language and why it is suitable for DSLs and how the entire process works. &lt;/p&gt;  &lt;p&gt;Looking forward for your comments.&lt;/p&gt;</description><link>http://ayende.com/blog/4418/dotnetrocks-on-domain-specific-languages?key=049a41e1-9e77-4544-85ee-6de268a81909</link><guid>http://ayende.com/blog/4418/dotnetrocks-on-domain-specific-languages?key=049a41e1-9e77-4544-85ee-6de268a81909</guid><pubDate>Tue, 02 Mar 2010 18:59:00 GMT</pubDate></item><item><title>DSLs in Boo discount offer</title><description>&lt;p&gt;&lt;a href="http://manning.com/rahien/"&gt;&lt;img style="display: inline; margin-left: 0px; margin-right: 0px" align="right" src="http://manning.com/rahien/rahien_cover150.jpg" /&gt;&lt;/a&gt;Manning is running a special today for &lt;a href="http://manning.com/rahien/"&gt;my book&lt;/a&gt;, 50% off print &amp;amp; ebook versions.&lt;/p&gt;  &lt;p&gt;Just use the following code: boo50&lt;/p&gt;  &lt;p&gt;Note that this code is valid only for today, so hurry up!&lt;/p&gt;</description><link>http://ayende.com/blog/4384/dsls-in-boo-discount-offer?key=b5b42cf4-685a-463d-b17f-297dd8a5ffae</link><guid>http://ayende.com/blog/4384/dsls-in-boo-discount-offer?key=b5b42cf4-685a-463d-b17f-297dd8a5ffae</guid><pubDate>Tue, 02 Feb 2010 18:04:00 GMT</pubDate></item><item><title>DSLs in Boo is out!</title><description>&lt;p&gt;&lt;a href="http://manning.com/rahien"&gt;&lt;img style="margin: 0px; display: inline" alt="7i3h.jpg" align="right" src="http://img49.yfrog.com/img49/9875/7i3h.jpg" width="180" height="240" /&gt;&lt;/a&gt;It has been quite a journey for me, &lt;a href="http://ayende.com/Blog/archive/2007/10/12/Book-Idea-Writing-Domain-Specific-Languages-in-Boo.aspx"&gt;starting in 2007(!)&lt;/a&gt; up until about a month ago, when the final revision is out. I am &lt;em&gt;very&lt;/em&gt; happy to announce that &lt;a href="http://manning.com/rahien"&gt;my book&lt;/a&gt; is now available in its final form.  &lt;/p&gt;  &lt;p&gt;When I actually got the book in my hands I was ecstatic. That represent about two years worth of work, and some pretty tough hurdles to cross (think about the challenge that editing something the size of a book from &lt;em&gt;my&lt;/em&gt; English is). And getting the content right was even harder. &lt;/p&gt;  &lt;p&gt;On the one hand, I wanted to write something that is &lt;em&gt;actionable&lt;/em&gt;, my success criteria for the book is that after reading it, you can go ahead and write production worthy Domain Specific Languages implementations. On the other hand, I didn’t want to have the reader left without the theoretical foundation that is required to understand what is actually going on. &lt;/p&gt;  &lt;p&gt;Looking back at this, I think that I managed to get that done well enough. The total page count is ~350 pages, and without the index &amp;amp; appendixes, it is just about 300 pages. Which, I hope, is big enough to give you working knowledge without bogging you down with too much theory.&lt;/p&gt;</description><link>http://ayende.com/blog/4373/dsls-in-boo-is-out?key=3d76b451-0c88-41e4-a22a-438b566960d6</link><guid>http://ayende.com/blog/4373/dsls-in-boo-is-out?key=3d76b451-0c88-41e4-a22a-438b566960d6</guid><pubDate>Sat, 23 Jan 2010 10:00:00 GMT</pubDate></item><item><title>My book is on Manning &amp;ndash; deal of the day</title><description>&lt;p&gt;My &lt;a href="http://archive.constantcontact.com/fs043/1101335703814/archive/1102858977249.html"&gt;book is on Manning’s Deal of the Day&lt;/a&gt;. DSLs in Boo: Domain Specific Languages in .NET – get the ebook for $10  by using &lt;a href="http://archive.constantcontact.com/fs043/1101335703814/archive/1102858977249.html"&gt;this link&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The journey for the book is done, so it is the full deal and the final version that you’ll be getting.&lt;/p&gt;</description><link>http://ayende.com/blog/4327/my-book-is-on-manning-ndash-deal-of-the-day?key=3257db9a-9e12-462e-b2be-c42f1321e336</link><guid>http://ayende.com/blog/4327/my-book-is-on-manning-ndash-deal-of-the-day?key=3257db9a-9e12-462e-b2be-c42f1321e336</guid><pubDate>Tue, 15 Dec 2009 06:45:00 GMT</pubDate></item><item><title>Help needed: Writing Domain Specific Languages in Boo – Java Edition</title><description>&lt;p&gt;Just came out of a discussion with Manning about my book (which is approach the last few stages before actually printing!), apparently they hit upon the notion that Boo works on both the CLR and the JVM, and are interested in having a Java edition of the book.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Disclaimer: This is early, and anything is subject to change, blah blah blah.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I find this hilarious, since this is Hibernate in Action vs. NHibernate in Action, in reverse. At least, I hope it is. The problem? I am not familiar enough with Java to be able to write a book targeting it, hence this post.&lt;/p&gt;  &lt;p&gt;If you are familiar with Java and BooJay (filter 90%), read my book (filter 90%) and think you could help (filter 0%), I would love to talk to you.&lt;/p&gt;</description><link>http://ayende.com/blog/3972/help-needed-writing-domain-specific-languages-in-boo-java-edition?key=e3cfd267-ac7c-450b-8527-e4486a25616c</link><guid>http://ayende.com/blog/3972/help-needed-writing-domain-specific-languages-in-boo-java-edition?key=e3cfd267-ac7c-450b-8527-e4486a25616c</guid><pubDate>Thu, 23 Apr 2009 16:10:49 GMT</pubDate></item><item><title>M is to DSL as Drag &amp; Drop is to programming</title><description>&lt;p&gt;&lt;a href="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/MistoDSLasDragDropistoprogramming_C9D9/image_2.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; margin: 0px 40px 0px 0px; border-left: 0px; border-bottom: 0px" height="170" alt="image" src="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/MistoDSLasDragDropistoprogramming_C9D9/image_thumb.png" width="170" align="left" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I have been sitting on this post for a while now, because that was my first impression after seeing Oslo &amp;amp; M and all the hype around it from the PDC. To be frank, I had a hard time believing my own gut feeling. I kept having the feeling that I am missing something, which is why I avoided talking about this so far.&lt;/p&gt;  &lt;p&gt;But, as time passed, and as we started to see more and more about Oslo and M, it validated my initial thinking. Now, just to be clear, I don’t intend to even touch on the whole of Oslo in this post. I don’t have a problem stating that I still don’t see the whole point there, but that is beside the point (no pun intended). What I would like to talk about is the M language, its usage, and the DSL that Microsoft shows as samples.&lt;/p&gt;  &lt;p&gt;I see M as a whole lot of effort trying to optimize something that is really not that interesting, complex or really very hard. I look at the M language, the way that you worked with, the tooling and the API and I would fully agree that it is a nice parser generator. &lt;/p&gt;  &lt;p&gt;What it is &lt;em&gt;not&lt;/em&gt;, I have to say, is a DSL toolkit. It is just one, small, part of building a DSL. And, to be perfectly honest, M is the drag &amp;amp; drop of DSL. It &lt;em&gt;looks&lt;/em&gt; good, on first glance, but then you dig just a little deeper and you see what actually going on, and you realize that you are probably not where you wanted to be.I  see it as trying very hard to optimize opening the car’s door. While I assume that this is interesting to &lt;em&gt;someone&lt;/em&gt; in the world, optimizing the opening of a car door is crucial, I don’t really see it as an important feature. More to the point, it has negligible effect on the time taken for the primary task for which we use a car, the actual driving!&lt;/p&gt;  &lt;p&gt;Why am I saying that?&lt;/p&gt;  &lt;p&gt;Well, M is used for defining the syntax of the language, which is what most people look at. It does a good job there, but it also &lt;em&gt;stops &lt;/em&gt;there. And there is a lot of stuff other then the syntax that you really care about.&lt;/p&gt;  &lt;p&gt;Here is a snippet from &lt;a href="http://www.claudioperrone.com/blog/articles/2008/11/09/misbehave-01-oslos-mgrammar-for-bdd-executable-specifications/"&gt;MisBehave&lt;/a&gt;, which was an attempt to build a BDD framework on top of M:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/MistoDSLasDragDropistoprogramming_C9D9/image_4.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="70" alt="image" src="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/MistoDSLasDragDropistoprogramming_C9D9/image_thumb_1.png" width="303" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Pretty impressive syntax, right? &lt;/p&gt;  &lt;p&gt;The problem is that there isn’t really a good way to take this and translate that into something that is &lt;em&gt;executable&lt;/em&gt;. Not without doing a &lt;em&gt;lot&lt;/em&gt; of work. And that is why I am saying that M isn’t really an important piece of the stack. The actual syntax definition isn’t really that important. It is all the other things that you do with the DSL that matters. &lt;/p&gt;  &lt;p&gt;Let us take a look at &lt;a href="http://www.douglaspurdy.com/2009/03/20/murl-a-dsl-for-restful-clients/"&gt;MUrl&lt;/a&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/MistoDSLasDragDropistoprogramming_C9D9/image_6.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="533" alt="image" src="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/MistoDSLasDragDropistoprogramming_C9D9/image_thumb_2.png" width="711" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I am looking at this, and after looking at the source code, I still can’t figure out the point.&lt;/p&gt;  &lt;p&gt;Yes, this is a demo DSL. But it is a good example that shows how you can completely miss the point with regards to a DSL. What problem does this DSL solve? What benefits do I get from integrating that into my system?&lt;/p&gt;  &lt;p&gt;&lt;em&gt;How does this helps me solve a real problem?&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;The answer is that it doesn’t. The only remotely useful case that I can think of is if I really want to be able to issue REST calls from the command line, and even then, there are better ways of doing that on the command line. MUrl is an exercise in abstraction for the sake of abstraction. More than that, it gives the impression that it is something that is is not.&lt;/p&gt;  &lt;p&gt;If you want to show me a DSL, show me one that has logic, not one that is a glorified serialization format. That is the sweet spot for a DSL, to extract policy decisions from your systems, so you can work with them at a higher level and have easier time making change.&lt;/p&gt;  &lt;p&gt;M is not a language for creating DSL. It is a language to define a serialization format, that is all.&lt;/p&gt;</description><link>http://ayende.com/blog/3922/m-is-to-dsl-as-drag-drop-is-to-programming?key=fdc02ab3-586a-4369-a2e8-f4c85a9a3864</link><guid>http://ayende.com/blog/3922/m-is-to-dsl-as-drag-drop-is-to-programming?key=fdc02ab3-586a-4369-a2e8-f4c85a9a3864</guid><pubDate>Mon, 23 Mar 2009 12:21:22 GMT</pubDate></item><item><title>Building Domain Specific Languages with Boo – Full book now available</title><description>&lt;p&gt;&lt;a href="http://www.manning.com/affiliate/idevaffiliate.php?id=854_111"&gt;&lt;img alt="Building DSL with Boo Cover" src="http://www.ayende.com/images/rahien_cover150.jpg" border="0" /&gt;      &lt;br /&gt;Building Domain Specific Languages with Boo&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Another big milestone, early access subscribers can now read the entire book, all 13 chapters and both appendixes.&lt;/p&gt;  &lt;p&gt;Not edited yet, but much closer to completion.&lt;/p&gt;</description><link>http://ayende.com/blog/3892/building-domain-specific-languages-with-boo-full-book-now-available?key=d92eee5d-d235-42b0-8b18-4280ba334893</link><guid>http://ayende.com/blog/3892/building-domain-specific-languages-with-boo-full-book-now-available?key=d92eee5d-d235-42b0-8b18-4280ba334893</guid><pubDate>Mon, 02 Mar 2009 00:22:20 GMT</pubDate></item><item><title>DSL: Tests as documentation</title><description>&lt;p&gt;I have several DSL that have no documentation beyond their source and the tests. They are usable, useful and have been of a lot of help. However, I have run into situations where I, as the language author, could not answer a question about the language without referring to the code. I strongly recommend in investing the time to create good documentation in your DSL. &lt;/p&gt;&lt;p&gt;Even if you are using a Behavior Driven Design flavored tests, it is not quite enough. Those types of tests can help make it clear what the language is doing, but they are not the type of documentation that you can hand to an end user and expect them to start using the language. &lt;/p&gt;&lt;p&gt;Even if your users are developers, it is not nearly good enough approach. It is your responsibility to make the system easy to use for the users, and documentation is a key part of that. &lt;/p&gt;&lt;p&gt;Handing them the tests is a good way to handle the complex cases, if your users are developers, but it is not a good way to reduce the learning curve.&lt;/p&gt;</description><link>http://ayende.com/blog/3859/dsl-tests-as-documentation?key=e68f43ca-8dab-48a6-8afb-a4e1c2e9af59</link><guid>http://ayende.com/blog/3859/dsl-tests-as-documentation?key=e68f43ca-8dab-48a6-8afb-a4e1c2e9af59</guid><pubDate>Mon, 09 Feb 2009 10:48:11 GMT</pubDate></item><item><title>I need some advice about the book</title><description>&lt;p&gt;I have got the final reviews about the book (Building Domain Specific Languages with Boo), and a few of them talk about a problem in the book that I am not sure how to solve.&lt;/p&gt;  &lt;p&gt;The problem is, quite simply, the book talks about Boo a lot. I see the book not as a academic topic, but as something that would give the reader actionable knowledge. At the same time, I try to cover the entire life cycle of a DSL. So the book covers things like how to design a good syntax, documenting DSLs, how to structure them, versioning issues and other aspects that are mostly agnostic to the actual tool that we use to build the DSL.&lt;/p&gt;  &lt;p&gt;On the other hand, things like integrating with a unit testing framework, or building UI, or the exact particulars about how to build certain aspects of the DSL and common recipes for frequent problems are strongly tied to the actual technology that we are using. Oh, we can probably discuss some of them in abstract, but I don’t think it would be nearly as valuable.&lt;/p&gt;  &lt;p&gt;One of the goals that I have when writing this book is to create an actionable document, one that you can use to start working on a DSL right away. There are several DSLs out there that I can directly trace to the book (Simple State Machine and Horn), so I think that I did a good job there.&lt;/p&gt;  &lt;p&gt;The problem, as reflected in the reviews, that people expected to see much more about DSLs and maybe get some brief discussion about the actual implementation in Boo.&lt;/p&gt;  &lt;p&gt;I think that the main issue is different expectations that they had, and I am wondering what we can do about it. One of the options that we consider is to rename the book to reflect what it actually contain better. However, I don’t know what name would suit it better, and I don’t even know if that is the best solutions.&lt;/p&gt;  &lt;p&gt;Can you offer some suggestions?&lt;/p&gt;</description><link>http://ayende.com/blog/3806/i-need-some-advice-about-the-book?key=4351da2e-69c7-4bf2-b988-5cde700c08c6</link><guid>http://ayende.com/blog/3806/i-need-some-advice-about-the-book?key=4351da2e-69c7-4bf2-b988-5cde700c08c6</guid><pubDate>Wed, 14 Jan 2009 17:15:23 GMT</pubDate></item><item><title>Should you be able to define new abstractions in a Domain Specific Language?</title><description>&lt;p&gt;Fowler has a &lt;a href="http://martinfowler.com/bliki/DslExceptionalism.html"&gt;post about DSL&lt;/a&gt;, which contain the following:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;The first is in language design. I was talking with a language designer who I have a lot of respect for, and he stressed that a key feature of languages was the ability to define new abstractions. With DSLs I don't think this is the case. In most DSLs the DSL chooses the abstraction you work with, if you want different abstractions you use a different DSL (or maybe extend the DSL you're using). Sometimes there's a role for new abstractions, but those cases are the minority and when they do happen the abstractions are limited. Indeed I think the lack of ability to define new abstractions is one of the things that distinguishes DSLs from general purpose languages.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;I disagree with the statement that this is an exception. This is something that come up again and again in a DSL. You start with a given concept of what you want to do, and you give it to the users. Rinse &amp;amp; repeat a couple of time and you have a language that the users can start play with.&lt;/p&gt; &lt;p&gt;The main problem is that not giving the users that facilities for abstraction usually mean that they will work around your system, or that the DSL scripts that you will have will suffer from copy &amp;amp; paste, unnecessary complexity, etc.&lt;/p&gt; &lt;p&gt;A trivial example would be how to define customer roles. You want to be able to process orders based on customer role, and as such, it is important to be able to define how you choose a customer. Not only that, but even the customer selection criteria should be abstracted.&lt;/p&gt; &lt;p&gt;Here are a few examples:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Bad customer:&lt;/li&gt; &lt;ul&gt; &lt;li&gt;Bad credit rating&lt;/li&gt; &lt;li&gt;OR More than 5 returns last year&lt;/li&gt; &lt;li&gt;OR More than 5 helpdesk calls last 6 months&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Silver Customer&lt;/li&gt; &lt;ul&gt; &lt;li&gt;More than 5 purchases&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Gold Customer&lt;/li&gt; &lt;ul&gt; &lt;li&gt;Total purchases over 5,000$&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Preferred customer:&lt;/li&gt; &lt;ul&gt; &lt;li&gt;Not a bad customer&lt;/li&gt; &lt;li&gt;Gold customer&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt; &lt;p&gt;We want to define roles using other roles. Because that is how the &lt;em&gt;business&lt;/em&gt; thinks about it. We naturally create abstractions for ourselves, because this is how we think.&lt;/p&gt; &lt;p&gt;If we need to go back to the development team for each new abstraction, we have a heavy weight process that the users will work around.&lt;/p&gt; &lt;p&gt;Most of my DSL contains some form of user define abstractions, usually in the form of:&lt;/p&gt; &lt;blockquote&gt;&lt;pre&gt;define bad_customer:
	customer.HasBadCredit or 
		customer.TotalReturnsIn(1.year) &amp;gt; 5 or
		customer.TotalHelpdeskCallsin(6.months) &amp;gt; 5

define silver_customer:
	customer.TotalPurchases &amp;gt; 5

define gold_customer:
	customer.TotalPurchasesAmount &amp;gt; 5000

define preferred_customer:
	gold_customer and not bad_customer
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;This is usually user editable, and we plug this into the intellisense of the system. In one project, I even provided a refactoring support, Extract Business Term (bound to CTRL+ALT+V, go R#!)&lt;/p&gt;
&lt;p&gt;Abstractions are important, and building them into the language is just as important. You &lt;em&gt;want&lt;/em&gt; to empower the users to extend your language, even if it a language that is very limited in scope. Because you give them the option to take the language to realms that you never dreamed on.&lt;/p&gt;</description><link>http://ayende.com/blog/3764/should-you-be-able-to-define-new-abstractions-in-a-domain-specific-language?key=0301c629-e792-42b0-9c2d-a7fcd932c919</link><guid>http://ayende.com/blog/3764/should-you-be-able-to-define-new-abstractions-in-a-domain-specific-language?key=0301c629-e792-42b0-9c2d-a7fcd932c919</guid><pubDate>Tue, 23 Dec 2008 01:58:55 GMT</pubDate></item><item><title>A very significant milestone</title><description>&lt;p&gt;Today, around 3 AM, I finally submitted the last chapter in the book.&lt;/p&gt; &lt;p&gt;I was surprised to realize that it took over a year to write it, and I am happy beyond words that the action of writing the book is behind me.&lt;/p&gt; &lt;p&gt;That said, it is not actually the end of the work. All it means is that I am done writing new content, now we are going to get into a cycle of editing once more, and I really don't look forward to re-reading what I wrote five to ten times, over and over and over again.&lt;/p&gt; &lt;p&gt;Nevertheless, I am feeling &lt;em&gt;GREAT!&lt;/em&gt;&lt;/p&gt;</description><link>http://ayende.com/blog/3743/a-very-significant-milestone?key=cdd868b9-f54b-46f0-8ea2-0eba1ae95a0e</link><guid>http://ayende.com/blog/3743/a-very-significant-milestone?key=cdd868b9-f54b-46f0-8ea2-0eba1ae95a0e</guid><pubDate>Mon, 08 Dec 2008 13:44:46 GMT</pubDate></item><item><title>Integrating User Interface &amp; Domain Specific Languages</title><description>&lt;p&gt;User interface is often seen as an external piece of the DSL, something that is completely separated from the language. While this is one options to handle things, it is not necessarily the only one. &lt;/p&gt;&lt;p&gt;During the design of the DSL, we should also think about the user interface that we intend to give our users. That will change the way that we build the language, usually, but not only because we need to give the UI more information, but because we can also utilize the UI to make things easier. &lt;/p&gt;&lt;p&gt;In particular, a good usage of the UI will allow us to give the users more information. Using the Shopping Cart DSL, we can utilize the UI to show the users what are the actions that will be taken on bad credit for all types of customers, or what it means to be a preferred customer. This is a very efficient way of writing documentation, once that is also guaranteed to be always updated. &lt;/p&gt;&lt;p&gt;A mockup of a screen reporting on the behavior of the system, as extracted from the DSL scripts: &lt;/p&gt;&lt;p&gt;&lt;a href="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/IntegratingUserInterfaceDomainSpecificLa_71B2/image_2.png"&gt;&lt;img height="245" alt="image" src="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/IntegratingUserInterfaceDomainSpecificLa_71B2/image_thumb.png" width="463" border="0" /&gt;&lt;/a&gt;  &lt;/p&gt;&lt;p&gt;This is a very important concept because it is showing the user data that the DSL isn't actually able to show. This is aggregated data across all behaviors and in all states, something that in the past you would have to either remember or research every time that you wanted to find out what is actually happening. &lt;/p&gt;&lt;p&gt;In short, don't try to limit yourself to just the typical IDE option, a DSL can and should give you a lot more information, and using this information can give you a lot of insight into your business. &lt;/p&gt;</description><link>http://ayende.com/blog/3742/integrating-user-interface-domain-specific-languages?key=59f6ab2b-4051-4739-b360-9829d6edbe01</link><guid>http://ayende.com/blog/3742/integrating-user-interface-domain-specific-languages?key=59f6ab2b-4051-4739-b360-9829d6edbe01</guid><pubDate>Mon, 08 Dec 2008 06:05:14 GMT</pubDate></item><item><title>The shopping cart rule engine DSL</title><description>&lt;p&gt;As the final example in the book, I am showing off a DSL for processing a shopping cart. Here is how it looks like:&lt;/p&gt; &lt;blockquote&gt;&lt;pre&gt;&lt;font color="#0000ff"&gt;behavior of &lt;/font&gt;preferred_customer

&lt;font color="#0000ff"&gt;upon&lt;/font&gt; bad_credit:
	authorize_funds cart.Total * 0.5,  "&lt;span style="color: #8b0000"&gt;For preferred customers we only authorize half the amount&lt;/span&gt;"

&lt;font color="#0000ff"&gt;upon&lt;/font&gt; cart_update:
	&lt;font color="#0000ff"&gt;when&lt;/font&gt; cart.Total &amp;gt; 1000:
  		add_cart_discount 5, "&lt;span style="color: #8b0000"&gt;Preferred members gets 5% discount for orders over 1,000$&lt;/span&gt;"
&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;And this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font color="#0000ff"&gt;behavior of &lt;/font&gt;default_customer 
&lt;/p&gt;&lt;p&gt;&lt;font color="#0000ff"&gt;upon&lt;/font&gt; bad_credit:&lt;br /&gt;      authorize_funds cart.Total,  &lt;font color="#800000"&gt;"We require full authorization of the amount in low credit rating scenarios"&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;Where we defined preferred customer and default customer as:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;font color="#0000ff"&gt;define&lt;/font&gt; preferred_customer:
	customer.TotalPurchaseAmount &amp;gt; 5000
	
&lt;font color="#0000ff"&gt;define&lt;/font&gt; default_customer:
	customer.TotalPurchaseAmount &amp;lt;= 5000&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;The implementation is surprisingly easy, and I was able to walk through the reasoning for this implementation rather than the usual when [condition] in a way that I hope would make sense.&lt;/p&gt;
&lt;p&gt;You can look at the implementation here: &lt;a title="https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/BDSLiB/trunk" href="https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/BDSLiB/trunk"&gt;https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/BDSLiB/trunk&lt;/a&gt;&lt;/p&gt;</description><link>http://ayende.com/blog/3740/the-shopping-cart-rule-engine-dsl?key=00421fb7-6fcd-496c-9cd2-dfbf62a52325</link><guid>http://ayende.com/blog/3740/the-shopping-cart-rule-engine-dsl?key=00421fb7-6fcd-496c-9cd2-dfbf62a52325</guid><pubDate>Mon, 08 Dec 2008 05:35:29 GMT</pubDate></item><item><title>Kazien Conf Workshops</title><description>&lt;p&gt;Yesterday I gave two workshops, Advanced NHibernate and Building DSL with Boo. I finished the day absolutely crushed, but I think they went very well.&lt;/p&gt;
&lt;p&gt;Both were recorded, although I am not sure when they will be online.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.techfocus2.com/2008/10/kaizenconf-workshops-advanced-nhibernate/"&gt;Ryan Kelley&lt;/a&gt; has a blow by blow description of the NHibernate talk, and you can get the code for that here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/SampleApplications/ORM+=2/"&gt;https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/SampleApplications/ORM+=2/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I'll post the code for the DSL talk shortly afterward.&lt;/p&gt;
&lt;p&gt;I got some really positive feedback about the NHibernate Profiler, and I am very interested in demoing that and getting additional feedback when the real conference starts.&lt;/p&gt;
</description><link>http://ayende.com/blog/3665/kazien-conf-workshops?key=adfb754c-4bdd-4146-9b2c-e7549dc24587</link><guid>http://ayende.com/blog/3665/kazien-conf-workshops?key=adfb754c-4bdd-4146-9b2c-e7549dc24587</guid><pubDate>Fri, 31 Oct 2008 15:35:28 GMT</pubDate></item><item><title>Every DSL ends up being Smalltalk</title><description>&lt;p&gt;I had this though in my head for a while now. I built an IDE for a DSL, and somewhere toward the end of the first revision I understood something very interesting. My IDE wasn't actually using the textual representation of the language. The scripts that the user was editing were actually &lt;em&gt;live instances, &lt;/em&gt;and they were fully capable of validating and saving themselves.&lt;/p&gt; &lt;p&gt;The IDE worked with those instances, used them to do its operations, and allowed to edit them on the fly. It was quite challenging to do, I must say, and I kept thinking about the image model of smalltalk, where everything is a live instance.&lt;/p&gt; &lt;p&gt;This brings to mind &lt;a href="http://en.wikipedia.org/wiki/Greenspuns_tenth_rule"&gt;Greenspan's tenth rule&lt;/a&gt;, which state: Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.&lt;/p&gt;</description><link>http://ayende.com/blog/3660/every-dsl-ends-up-being-smalltalk?key=f42bce04-a966-4fbc-8ce6-44fe6b76f957</link><guid>http://ayende.com/blog/3660/every-dsl-ends-up-being-smalltalk?key=f42bce04-a966-4fbc-8ce6-44fe6b76f957</guid><pubDate>Sun, 26 Oct 2008 23:37:40 GMT</pubDate></item><item><title>New version of the book is out</title><description>&lt;p&gt;You can head to the &lt;a href="http://manning.com/rahien/"&gt;Book Site&lt;/a&gt; and get a new version, because Chapters 1 - 11 (and appendix B) are available.&lt;/p&gt;
&lt;p&gt;The only remaining chapters are #12 (DSL implementation patterns) and #13 Implementing a Real World DSL. Chapter 12 goes really well, so far, and I hope to have it ready by the end of the weekend.&lt;/p&gt;
</description><link>http://ayende.com/blog/3626/new-version-of-the-book-is-out?key=804fad49-cd98-49f9-96d5-0d5fd68fd477</link><guid>http://ayende.com/blog/3626/new-version-of-the-book-is-out?key=804fad49-cd98-49f9-96d5-0d5fd68fd477</guid><pubDate>Thu, 02 Oct 2008 19:54:15 GMT</pubDate></item><item><title>Chapter 11 is done, or the tale of meta documentation</title><description>&lt;p&gt;Here it the table of content:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Writing the Getting Started Guide&lt;/li&gt; &lt;ul&gt; &lt;li&gt;Create Low Hanging Fruits&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;The User Guide&lt;/li&gt; &lt;ul&gt; &lt;li&gt;Documenting the Language Syntax&lt;/li&gt; &lt;li&gt;The Language Reference&lt;/li&gt; &lt;li&gt;Debugging for business users&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Creating developer documentation&lt;/li&gt; &lt;ul&gt; &lt;li&gt;Outlining DSL structure&lt;/li&gt; &lt;li&gt;The syntax implementation&lt;/li&gt; &lt;ul&gt; &lt;li&gt;Keywords&lt;/li&gt; &lt;li&gt;Behaviors&lt;/li&gt; &lt;li&gt;Conventions&lt;/li&gt; &lt;li&gt;Notations&lt;/li&gt; &lt;li&gt;External Integration&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt; &lt;li&gt;Documenting AST transformations&lt;/li&gt; &lt;li&gt;Executable documentation&lt;/li&gt; &lt;li&gt;Summary&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;The chapter starts with...&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Documentation is a task that most developers strongly dislike. It is treated as a tedious, annoying task and often falls on the developer who protests the least. One additional problem is that a developer trying to document his own work is often not going to do a good work. &lt;/p&gt;&lt;p&gt;This is not an aspiration against developers in general; the problem is that there are too many things that people who actually write the code takes for granted. And even in we ignore that, developers tend to write to developers, in a way that makes little sense to non developers.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;That is true for me as well. And trying to document how developers should write documentation is... hard. &lt;/p&gt;&lt;p&gt;At least I can look forward for a really interesting Chapter 12.&lt;/p&gt;</description><link>http://ayende.com/blog/3612/chapter-11-is-done-or-the-tale-of-meta-documentation?key=75303329-7f02-4f20-a69d-78a816366365</link><guid>http://ayende.com/blog/3612/chapter-11-is-done-or-the-tale-of-meta-documentation?key=75303329-7f02-4f20-a69d-78a816366365</guid><pubDate>Fri, 26 Sep 2008 19:00:52 GMT</pubDate></item><item><title>Enter the demoware</title><description>&lt;p&gt;I am writing about documentation at the moment, and I found myself writing the following: &lt;/p&gt;&lt;blockquote&gt; &lt;p&gt;I don’t think that I can emphasize enough how important it is to have a good first impression in the DSL. It can literally make or break your project. We should make above reasonable efforts to ensure that the first impression of the user from our system would be positive.  &lt;/p&gt;&lt;p&gt;This includes investing time in building good looking UI, and snappy graphics. They might not actually have a lot of value for the project from a technical perspective, not even from the point of day to day usage in some cases, but they are crucially important from social engineering perspective.  &lt;/p&gt;&lt;p&gt;A project that looks good is pleasant to use, easier to demo and in general easier to get funding for.  &lt;/p&gt;&lt;p&gt;This also includes the documentation, if we can do something in a short amount of time; we get a level of trust from the users. “Hey, I can make it go bang!” is important to gain acceptance. The first stage should be a very easy one, even if you have to design to enable that specifically. &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;After reading that, I quickly added this as well: &lt;/p&gt;&lt;blockquote&gt; &lt;p&gt;Note, however, that you should be wary of creating a demoware project, one that is strictly focused on demoing well, and not actually add value in real world conditions. Such projects may demo well, and get funding and support, but they tend to fall into the land of tortureware very rapidly, making things harder to do, instead of easier. &lt;/p&gt;&lt;p&gt;Beware of the demoware.&lt;/p&gt;&lt;/blockquote&gt;</description><link>http://ayende.com/blog/3603/enter-the-demoware?key=3eae381d-bda1-44e7-9290-d05129521bf6</link><guid>http://ayende.com/blog/3603/enter-the-demoware?key=3eae381d-bda1-44e7-9290-d05129521bf6</guid><pubDate>Sun, 21 Sep 2008 08:49:55 GMT</pubDate></item><item><title>Persistent DSL caching issues</title><description>&lt;p&gt;A while ago I talked about &lt;a href="http://www.ayende.com/Blog/archive/2008/09/04/Persistent-DSL-Caching.aspx"&gt;persistent DSL caching&lt;/a&gt;. I was asked why my solution was not a builtin part of Rhino DSL. &lt;/p&gt;  &lt;p&gt;The reason for that is that this is actually a not so simple problem. Let me point out a few of the issues that are non obvious.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Need to handle removal of scripts&lt;/li&gt;    &lt;li&gt;Need to handle updating scripts&lt;/li&gt;    &lt;li&gt;Need to handle new scripts&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Those are easy, sort of, but what about this one?&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Need to handle DSL updates&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;When you are in development mode, you &lt;em&gt;really&lt;/em&gt; need to know that changing the way the DSL behaves would also invalidate any cache.&lt;/p&gt;  &lt;p&gt;I like to keep a very high bar of quality on the software I make, and there is a fine distinction between one off attempts and reusable ones. One off attempts can be hackish and stupid. Reusable implementations should be written properly.&lt;/p&gt;  &lt;p&gt;And no, there isn't anything overly complex here. Just time to test all bases.&lt;/p&gt;  &lt;p&gt;Anyone feels like sumbiting a patch?&lt;/p&gt;</description><link>http://ayende.com/blog/3591/persistent-dsl-caching-issues?key=f832bbbe-4b8d-4786-823f-a7ce531fb98d</link><guid>http://ayende.com/blog/3591/persistent-dsl-caching-issues?key=f832bbbe-4b8d-4786-823f-a7ce531fb98d</guid><pubDate>Wed, 10 Sep 2008 15:24:16 GMT</pubDate></item><item><title>Implementing generic natural language DSL</title><description>&lt;p&gt;I said that I would post about it, so here is the high level design for generic implementation of natural language looking parsing. Let us explore the problem scenario first. We want to be able to build this language, without having to build a full blown language from scratch:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;open http://www.ayende.com/     &lt;br /&gt;click on link to Blog       &lt;br /&gt;click on link to first post      &lt;br /&gt;enter comment with name Ayende Rahien and email &lt;a href="mailto:foo@example.org"&gt;foo@example.org&lt;/a&gt; and url &lt;a href="http://www.ayende.com/Blog/"&gt;http://www.ayende.com/Blog/&lt;/a&gt;      &lt;br /&gt;enter comment text This is an awesome post.      &lt;br /&gt;click on submit      &lt;br /&gt;comment with This is an awesome post should appear on page&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;And to prove that we are not focusing on a single language, let us try this one as well:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;when account balance is 500$ and withdrawal is made of 400$ we should get a low funds alert     &lt;br /&gt;when account balance is 500$ and withdrawal is made of 501$ we should deny the transaction      &lt;br /&gt;when weekly international charge is at 3,500$ and max weekly international charge is of 5,000$ and new charge arrives for amount 2,230$ we should deny the transaction&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I think that those are divergent enough to show that the solution is a generic one.&lt;/p&gt;  &lt;p&gt;And now, to the solution. Each type of language is going to have its own DSL engine, which know how to deal with the particular dialect that we are using. The default parsing is a three steps solution. First, split the text into sentences, then, split each sentence to tokens by whitespace. Now, for each statement, we search for the appropriate statement resolve, which is a class that knows how to deal with it. The statement resolver methods are then called to process the statement.&lt;/p&gt;  &lt;p&gt;There are two key principal to the design. First, turning something like 'click on link' to an invocation of the ClickOnLink statement resolver and lazy parameter evaluation.&lt;/p&gt;  &lt;p&gt;This is going to be interesting, the time right now is 19:38, and I am going to start implementing this. &lt;/p&gt;  &lt;p&gt;It is now 22:04, and I finished the first language. &lt;/p&gt;  &lt;p&gt;Working on the second now. It is 22:10 and I am done with the second one.&lt;/p&gt;  &lt;p&gt;What did I do? &lt;/p&gt;  &lt;p&gt;I took the text we had and turn that into executable commands. Now, this isn't flexible at all. If you make a modification in the way it is structured, it will fail, coming back to why natural language is a bad choice here, but it had quite a bit of flexibility in it.&lt;/p&gt;  &lt;p&gt;You can get the code for this, including tests, here: &lt;a title="https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/experiments/natrual-language" href="https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/experiments/natrual-language"&gt;https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/experiments/natrual-language&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;But let us talk for a bit about how this is implemented. I'll show the bank example, because it is easier.&lt;/p&gt;  &lt;p&gt;We start by defining the BankParser, which looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/ImplementinggenericnaturallanguageDSL_13BBB/image_4.png"&gt;&lt;img height="180" alt="image" src="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/ImplementinggenericnaturallanguageDSL_13BBB/image_thumb_1.png" width="307" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The bank parser merely define what the statement resolvers are, and any special parsers that are needed (in this case, we need to handle dollar values).&lt;/p&gt;  &lt;p&gt;A statement parser is trivial:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/ImplementinggenericnaturallanguageDSL_13BBB/image_6.png"&gt;&lt;img height="180" alt="image" src="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/ImplementinggenericnaturallanguageDSL_13BBB/image_thumb_2.png" width="403" border="0" /&gt;&lt;/a&gt; &lt;a href="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/ImplementinggenericnaturallanguageDSL_13BBB/image_8.png"&gt;&lt;img height="180" alt="image" src="http://ayende.com/Blog/images/ayende_com/Blog/WindowsLiveWriter/ImplementinggenericnaturallanguageDSL_13BBB/image_thumb_3.png" width="331" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;And yes, those are pure POCO classes.&lt;/p&gt;  &lt;p&gt;The whole idea here was that I can implement some smarts into the default engine about how it recognize methods and resolve parameters. I will admit that overloading caused some issues, but I think that this is pretty simple implementation.&lt;/p&gt;  &lt;p&gt;It also does a good job in demonstrating the problems in such a language. Go ahead and try to build operator precedence into it. Or implement an if statement. You really can't, not without introducing a lot more structure into it. And that would turn it into yet another programming language.&lt;/p&gt;  &lt;p&gt;What about the tooling? Intellisense and syntax highlighting?&lt;/p&gt;  &lt;p&gt;Well, since we have the structure of the code, and we know the conventions, you shouldn't have a problem taking my previous posts about this and translating them directly into supporting this.&lt;/p&gt;  &lt;p&gt;And yes, I can create a language in this in a few minutes, As BankParser has proven.&lt;/p&gt;</description><link>http://ayende.com/blog/3589/implementing-generic-natural-language-dsl?key=927af208-9517-4173-9a94-ec29a5e6ff42</link><guid>http://ayende.com/blog/3589/implementing-generic-natural-language-dsl?key=927af208-9517-4173-9a94-ec29a5e6ff42</guid><pubDate>Mon, 08 Sep 2008 19:27:16 GMT</pubDate></item></channel></rss>
