Steve Nelson, XML, and Why DSLs Should Be a Required Subject
An XML file can be seen as a Domain Specific Language for describing the solution to a problem within a constrained solution space. You can use XML to describe anything from controller functions to workflows to bean dependencies and configuration information. If you looked at the DTD, Schema or Relax NG description of the grammar, that would describe the underlying (abstract) grammar of any given XML document.
An important distinction here is between concrete and abstract grammars - and stay with me because this is actually quite useful. An abstract grammar describes the kinds of conceptual structures that a given language allows (for most languages you also have to add semantic constraints as often there will be syntactically valid statements that have no useful meaning). A concrete grammar is a particular way of writing an expression that conforms to that abstract grammar. So, for example if you have a DSL for describing workflows, I could write that using CF Script, a text file using indents and spaces for meaning, in XML or I could draw a diagram and these all might potentially be different valid concrete syntaxes to describe the same abstract grammar - to put it simply, they would all be valid, transformable ways of saying the same thing using different characters (or shapes) to denote the same underlying intent.
I have no idea what Steve is going to be saying at Frameworks, but one thing I will say is that a set of calls against an API can be thought of as a different concrete syntax which could be used in place of XML. For a certain subset of abstract grammars, an API can be a very appropriate concrete syntax to use, but you are still having to learn the same vocabulary (the abstract grammar and any associated semantic constraints of your DSL) to call your CFC or base class or API as you would be to write an XML file.
There are definitely strengths and weaknesses (as well as personal preferences) when choosing the most appropriate concrete grammar for a given DSL, but whether you use CFCs or XML, the language still needs to be defined and learnt. So the quote Jeff pulled:
In my opinion, using XML files to create a new framework programming language has more drawbacks than benefits. The biggest drawback is that the developer needs to learn yet another series of tags and syntax and keywords in order to use a framework
to me seems short of the mark (although I could be misunderstanding Steve completely). To me, there is a huge benefit in the expressiveness of a well designed DSL (whether you provide it as a CFC with a set of methods, an XML document, a custom textual syntax or a UML diagram). It reduces the number of characters required to express intent, cuts down on the likelihood of syntax errors, keeps your code DRYer and provides a host of other benefits. But whether you want to implement a DSL using an API or XML, the developer will need to learn your abstract grammar. I guess you could argue there is a minor benefit in not having to learn the concrete syntax of XML (although how hard are angle brackets to get?!), but just as you need to learn the tags and attributes for an XML concrete syntax, you need to learn the exact same concepts expressed using methods and properties if you implement the DSL using an API (probably a CFC) as your concrete syntax, so you can't beat up on XML for that.
I will be sure to attend Steve's talk next week to see what he is talking about and will post back here as I learn more!


This whole concept of "DSLs" is new to me. Are there any resources, aside from your blog?
http://www.martinfowler.com/articles/languageWorkb...
Martin Fowlers Bliki:
http://www.martinfowler.com/bliki/DomainSpecificLa...
and Wikipedia:
http://en.wikipedia.org/wiki/Domain-specific_progr...
You might also want to google "language oriented programming" to get the "big idea" and check out anything recent by Charles Simonyi over at Intentional Software.
When I read the quote you referenced, I had the same thought as you, namely "But whether you want to implement a DSL using an API or XML, the developer will need to learn your abstract grammar."
I agree there, but I'm still not loving the XML as DSL (not that it can't be done, I just prefer to do it in a less ... cluttery? ... way, if possible).
On another note, I seem to remember Martin Fowler having a good article on DSLs specifically... I don't have the reference, but ... nevermind, looks like you linked it in the 2nd comment you made. =)
Anyway, the code for the "socket" CFC and a normal web based CFC are all organized in the same manner and can talk to each other like nothing is different. It creates very nice consistency of the codebase even in applications that span technologies.
Certainly will be interesting to find out more - I'll be at frameworks and will definitely try to catch your presentation! Anywhere else we should look for documentation on your approach?
Peter, I laughed when I read that. I mean, it just sounds so non-chalant!
=)
The last time we did that some Romanian guys were opening bottles with their teeth. Those guys were out of control!