Wednesday, March 25, 2009

Boo

With Ayende's DSL book on the horizon i thought i would fire of some links and some background on Boo and DSLs as a couple of people have been asking about them of late.
Firstly Boo:
Boo is a Python-like language that sits on top of the CLI. It is pretty old (over 4 yrs old) so was written well before the DLR which mean it impresses me that much more! Its basically a scripty language that gives you the benefits of such languages. Unfortunately it does not have VS support, but you can download VS add-ins or SharpDeveloper, whcih is a Free IDE for C#, VB.Net and of course Boo. On a side note #Dev is also a good option as an auxiliary IDE (eg for you laptop) if you don't want to shell out for an additional VS licence.

Right, so what is a DSL?
A DSL is a Domain Specific Language which, to me, means a language that is tailored to a specific purposes. Now every person I speak to has a different opinion on what a DSL is, in fact we had a near on religious debate about this in one of the London .Net Beers when Ayende graced us with his presence. To be honest you have to be a little pragmatic and take in to context the situation. You could consider SQL a DSL as it is a language that is VERY specific to a given domain; that is interaction with Relational Databases. Although that may be valid in the context of me talking to another developer, I tend to assume that we are talking about something a little more business focused, like a rules engine or workflow. Personally I don't really like the notion that stems from Microsoft that by default a DSL is graphical; it works for some things reasonably well (eg Workflow) but it can quickly fall down when complexity increases or extensibility is required.
This is where the likes of Ruby and Boo shine. Ruby as we all know is the new "all singing, all dancing king of the coding world" in which one of the very cool things about it is that you can relatively easily create your own DSL. For a great intro to Ruby which covers briefly its DSL capabilities check out The Ruby Programming Language. Ruby may also be a good place to do back ground research on DSL as it has a larger community.
Boo, being Dynamic-ish, allows you to take some of these concepts and create DSLs in asimilar fashion.
Have ever done this?
No.
My Dynamic coding skills suck and i really need to get better, unfortunately Power shell, Java/Android and COD4 tend to get in the way. Luckily for us there are people waaaay smarter than me that can show the way, such as Ayende thru is blog and forthcoming book.
Ayende, for starters, blazes the trail by providing no less than 2 real world DSLs that YOU, a .Net developer, can use:
Bindsor- A boo based DSL theat allows you to configure your Castle Windsor IoC container from a .boo script file, allowing for dynamic changes, but in code. Binsor is available in Ayendes Rhino Commons
&
Bake - a boo based build system that is inspired by the Ruby build system "Rake", see what they have done there ;)

For some tutorials involving Binsor check out http://ruprict.wordpress.com/category/castle/
or flick through Ayende's blog, he covers a tonne of stuff there.

As a side note, I was speaking Fowler* and he mentioned that he was working on a DSL book but at the time (Mar 08) was thinking of flagging it... i am not sure if it will be reborn, but keep an eye out.

*yesssss awesome name dropping skillz!... sorry :)

No comments: