﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>pb commented on Challenge: Don't stop with the first DSL abstraction</title><description>C#: The ultimate DSL rules engine
  
  
It seems somewhat simple to split things up to make a fluent interface in C# that makes sense. But this is much more work.
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment21</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment21</guid><pubDate>Fri, 05 Sep 2008 01:56:38 GMT</pubDate></item><item><title>Ayende Rahien commented on Challenge: Don't stop with the first DSL abstraction</title><description>See the next post to see how I think we can introduce it.
  
A scenario with actions based on this scenario is actually very easy to explain
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment20</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment20</guid><pubDate>Thu, 04 Sep 2008 17:02:19 GMT</pubDate></item><item><title>Avish commented on Challenge: Don't stop with the first DSL abstraction</title><description>From your reply to Gilligan, I reckon that you think this snippet should convey chunked concepts like "preferred customers get 5 percent discount and extra credit" and "regular customers don't get no discount and we set feds after 'em soon as they try to f*ck with us". 
  
  
I'm not sure the users of this DSL will be able to grok the non-trivial concept of introducing new "thingies" into the DSL, and using them later. That's a very code-ish concept: declaration and usage.
  
  
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment19</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment19</guid><pubDate>Thu, 04 Sep 2008 16:45:14 GMT</pubDate></item><item><title>Ayende Rahien commented on Challenge: Don't stop with the first DSL abstraction</title><description>That is just playing with the syntax, and not really changing the abstraction
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment18</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment18</guid><pubDate>Thu, 04 Sep 2008 16:34:38 GMT</pubDate></item><item><title>Tobin Harris commented on Challenge: Don't stop with the first DSL abstraction</title><description>How about the ability to vary the language to make it read more naturally?
  
  
This might mean adding synonyms.
  
Also, you could have "fluff" keywords that make it read better but which are ignored by the interpreter.
  
  
This could be a totally *terrible* idea, I'm just thinking out loud :)
  
  
Example:
  
  
when a bounced_check arrives or refused_credit:
  
	if customer.TotalPurchases &gt; 10000: # preferred
  
		ask_authorizatin_for_more_credit
  
	otherwise
  
		call_the cops
  
  
when a new_order arrives:
  
	if customer.TotalPurchases &gt; 10000: # preferred
  
		apply_discount of 5.precent
  
  
when order_shipped happens:
  
     send_marketing_stuff unless the customer.RequestedNoSpam
  
  
Synonyms
  
  else =&gt; otherwise
  
  
Ignored Words (fluff keywords)
  
  a
  
  arrives
  
  the
  
  of
  
  happens
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment17</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment17</guid><pubDate>Thu, 04 Sep 2008 16:32:03 GMT</pubDate></item><item><title>Ayende Rahien commented on Challenge: Don't stop with the first DSL abstraction</title><description>Gilligan,
  
I _hate_ the syntax, but you got the right idea
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment16</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment16</guid><pubDate>Thu, 04 Sep 2008 15:49:17 GMT</pubDate></item><item><title>Gilligan commented on Challenge: Don't stop with the first DSL abstraction</title><description>Perhaps something roughly like this (excuse any bad syntax):
  
  
def: preferred_customer_status
  
 payment_failed = ask_authorization_for_more_credit
  
 discount = 5.percent
  
end def
  
  
def: regular_customer_status
  
 payment_failed = call_the_cops
  
 discount = 0.percent
  
end def
  
  
Then you would apply the rules as such:
  
if customer.TotalPurchases &gt; 10000:
  
customer_status = preferred_customer_status
  
else:
  
customer_status = regular_customer_Status
  
  
upon bounced_check or refused_credit:
  
 customer_status.payment_failed
  
  
upon new_order:
  
 apply_discount customer_status.discount
  
  
upon order_shipped:
  
     send_marketing_stuff unless customer.RequestedNoSpam
  
  
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment15</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment15</guid><pubDate>Thu, 04 Sep 2008 15:48:05 GMT</pubDate></item><item><title>Ayende Rahien commented on Challenge: Don't stop with the first DSL abstraction</title><description>Joseph,
  
Your approach is somewhat better, but still suffers from the same fundamental issue
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment14</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment14</guid><pubDate>Thu, 04 Sep 2008 14:38:48 GMT</pubDate></item><item><title>Joseph Gutierrez commented on Challenge: Don't stop with the first DSL abstraction</title><description>Try this:
  
  
ask_authorization_for_more_credit with preferred
  
   upon bounced_check or refused_credit:
  
  
call_the_cops without preferred
  
   upon bounced_check or refused_credit:
  
  
apply_discount 5.precent with preferred
  
   upon new_order
  
  
send_marketing_stuff unless customer.RequestedNoSpam
  
   upon order_shipped
  
  
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment13</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment13</guid><pubDate>Thu, 04 Sep 2008 14:32:51 GMT</pubDate></item><item><title>Bunter commented on Challenge: Don't stop with the first DSL abstraction</title><description>If number of rules grow, this DSL will be long as the river of amazon.
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment12</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment12</guid><pubDate>Thu, 04 Sep 2008 13:27:38 GMT</pubDate></item><item><title>James commented on Challenge: Don't stop with the first DSL abstraction</title><description>Maybe having a look at Specifications. by Eric Evans &lt;evans@acm.org&gt; and Martin Fowler &lt;fowler@acm.org&gt;
  
  
order_shipped_specification
  
new_order_specification
  
has_credit_specification
  
should_be_locked_up_specification
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment11</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment11</guid><pubDate>Thu, 04 Sep 2008 13:19:45 GMT</pubDate></item><item><title>Gilligan commented on Challenge: Don't stop with the first DSL abstraction</title><description>I have no experience with DSLs, but I sense something there I cannot quite wrap my brain around. Some things that I would toy around with:
  
  
1) bounced_check and refused_credit could probably be combined into some sort of payment_failed object or state on the order.
  
  
2) I would really like to keep things focused on the order instead of both the customer and the order, like Benny mentioned. Perhaps setting a "doNotSendMarketingStuff" property on the order (this would also allow you to track the history of a customer's "nospam" setting, to a point).
  
  
Actually, I do not even like my second point. I am back to square one.
  
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment10</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment10</guid><pubDate>Thu, 04 Sep 2008 13:03:57 GMT</pubDate></item><item><title>Benny Thomas commented on Challenge: Don't stop with the first DSL abstraction</title><description>I'm no DSL man, but this seems a bit odd:
  
  
upon order_shipped:     
  
    send_marketing_stuff unless customer.RequestedNoSpam
  
  
Every other place you are using if, and suddenly you are using unless. Inkonsistence in my world.
  
  
But i miss order handling stuff in your DSL, everything is about a customer, but nothing about the order.
  
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment9</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment9</guid><pubDate>Thu, 04 Sep 2008 10:51:39 GMT</pubDate></item><item><title>John commented on Challenge: Don't stop with the first DSL abstraction</title><description>You saw cockroaches at Starbucks?  Did you call the environmental services?
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment8</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment8</guid><pubDate>Thu, 04 Sep 2008 09:37:54 GMT</pubDate></item><item><title>firefly commented on Challenge: Don't stop with the first DSL abstraction</title><description>the unless part? :)
  
  
    upon bounced_check or refused_credit:
  
       		ask_authorizatin_for_more_credit unless IsNotPrefered
  
    		call_the cops unless Prefered
  
  
    upon new_order:
  
    		apply_discount 5.precent unless IsNotPrefered
  
  
    upon order_shipped:
  
         send_marketing_stuff unless customer.RequestedNoSpam
  
  
This way it's more uniform = easier for a parsing engine... or even a gui...
  
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment7</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment7</guid><pubDate>Thu, 04 Sep 2008 06:39:49 GMT</pubDate></item><item><title>Ayende Rahien commented on Challenge: Don't stop with the first DSL abstraction</title><description>Demis,
  
As I mentioned, this is a valuable part, but not by far the most important thing.
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment6</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment6</guid><pubDate>Thu, 04 Sep 2008 04:51:41 GMT</pubDate></item><item><title>Ayende Rahien commented on Challenge: Don't stop with the first DSL abstraction</title><description>Joao,
  
No, I try no to do things twice.
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment5</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment5</guid><pubDate>Thu, 04 Sep 2008 04:49:06 GMT</pubDate></item><item><title>Ayende Rahien commented on Challenge: Don't stop with the first DSL abstraction</title><description>Bob,
  
If you click on the book link on the side bar, you will go to a site where you can buy a PDF copy of the pre release version.
  
  
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment4</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment4</guid><pubDate>Thu, 04 Sep 2008 04:47:29 GMT</pubDate></item><item><title>Jo&amp;#227;o Bragan&amp;#231;a commented on Challenge: Don't stop with the first DSL abstraction</title><description>Is it crying for the 'why'?
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment3</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment3</guid><pubDate>Thu, 04 Sep 2008 04:34:18 GMT</pubDate></item><item><title>Bob commented on Challenge: Don't stop with the first DSL abstraction</title><description>Is there anyway to get your pre-release copy of your "Building DSL in Boo"? I'm completely lost in DSL world, and it extremely lacks of resources out there.
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment2</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment2</guid><pubDate>Thu, 04 Sep 2008 03:09:24 GMT</pubDate></item><item><title>Demis commented on Challenge: Don't stop with the first DSL abstraction</title><description>let preferred_customer = customer.TotalPurchases &gt; 10000 ?
</description><link>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment1</link><guid>http://ayende.com/3582/challenge-dont-stop-with-the-first-dsl-abstraction#comment1</guid><pubDate>Thu, 04 Sep 2008 00:41:16 GMT</pubDate></item></channel></rss>