Sunday, 31 December 2006

NAnt is a domain specific language

Last week (don't get the full Christmas break till next year <sigh>) I was introducing NAnt to a colleague, and described it for the first time as a domain-specific language (DSL). Although I've been using NAnt heavily for almost three years now, for building everything from VB5 (yes 5!) to C#, its true power only fully struck me when I used this term. Up till then I always described NAnt as a usable and readable makefile format.

The realisation hit me whilst I was experimenting with using Ruby, C# and Regular Expressions to do some tricky file analysis as part of a
NAnt build process. Whilst I would have preferred a NAnt-Ruby solution, time-constraints resulted in a NAnt-C# solution (using the powerful script task).

NAnt is a domain specific language because it defines a vocabulary specific to the process of building software. What makes it such a powerful DSL is that:
  • It has a very limited keyword set (even when you add in nantcontrib), which is focused on the job hand.
  • This in turn, allows very concise (once you get over the XML sit-ups) expression of knowledge.
  • This also eases its learning-curve, which is even further reduced when harnessing the power of:
  • Intellisense. The power of this cannot be understated, and the lack of this is my one bone of contention with Ruby.
  • It provides points of extension (via script and custom tasks), for the use of more appropriate languages where Nant is unsuitable.

No comments: