Live data from Hacker News

Why I hate XML for DSLs

theschemeway.blogspot.com

1–10 of 27 posts

Re: Why I hate XML for DSLs

#2
This is exactly the sentiment that led to us at QuickFuse (quickfuseapps.com) to skip creating yet another XML DSL for building voice apps. The voice dev ecosystem is overflowing with them, some new and some old (VoiceXML, TwiML, etc.), so we decided to move straight to a graphical representation that does the task.

For some things, a visual DSL like a callflow for voice apps or musical notation for music probably has the highest information density, and therefore becomes the most pleasing interface for being creative.

Re: Why I hate XML for DSLs

#3
There are two times when you'll be better of programming in XML. One is if the language you would otherwise be writing in is Java. (Or WCF in the MS stack)

The other is transforming XML documents (XSL) although this is quickly becoming more of a PITA than doing it natively as the various XML APIs start offering declarative syntaxes.

Re: Why I hate XML for DSLs

#4
I have to say that I've never considered using an XML for a DSL. Most of the reasons I've written DSLs usually involve a desire to avoid writing more code.

The closest I've come to writing an XML-like DSL are the many Lisp-lites that I've hacked up over the years. Most of the rest are either Forthish languages (if it's primarily for my use to avoid writing large quantities of Java, C*, Haskell, etc.) or rough "business natural language" DSLs for power users who want to tweak a process, object, or flow.

In general, I wouldn't even consider XML as a DSL unless I broaden my idea of a "DSL" to mean "any representation of a state or set of operations used by a computer," in which case I've written a lot of XSDs for machine-generated documents, such as serialized objects, messages to be placed on ESBs or queues, etc. But I do not think this article pertains to that sort of "language" either.

Re: Why I hate XML for DSLs

#7
I have created a programming language that is written in XML. With a decent editor (I use oxygen xml) and a good schema (I use Relax NG) there is almost no way to make syntax errors and typing is a breeze (auto completion). With schematron you can even make clever (semantic) error checking before compile time. So it always depends on the case.

Re: Why I hate XML for DSLs

#8
post #4

I have to say that I've never considered using an XML for a DSL. Most of the reasons I've written DSLs usually involve a desire to avoid writing more code. The closest I've come to writing an XML-like DSL are the many Lisp-lites that I've hacked up over the years. Most of the rest are either Forthish languages (if it's primarily for my use to avoid writing large quantities of Java, C*, Haskell, etc.) or rough "busine…

> I have to say that I've never considered using an XML for a DSL. Most of the reasons I've written DSLs usually involve a desire to avoid writing more code.

I'd like to ask a favor as a fellow programmer: pretend you never saw this article. The fewer XML-based DSLs, the better.

Re: Why I hate XML for DSLs

#9
post #3

There are two times when you'll be better of programming in XML. One is if the language you would otherwise be writing in is Java. (Or WCF in the MS stack) The other is transforming XML documents (XSL) although this is quickly becoming more of a PITA than doing it natively as the various XML APIs start offering declarative syntaxes.

> One is if the language you would otherwise be writing in is Java. (Or WCF in the MS stack)

I admit that I've never done any serious Java development, but that's jumping from the kettle into the fire, is it not? As verbose as Java is, it seems to be less so than XML would be.

Re: Why I hate XML for DSLs

#10
post #7

I have created a programming language that is written in XML. With a decent editor (I use oxygen xml) and a good schema (I use Relax NG) there is almost no way to make syntax errors and typing is a breeze (auto completion). With schematron you can even make clever (semantic) error checking before compile time. So it always depends on the case.

I don't doubt that you could write a DSL that someone would be productive with. But then you'd need to keep a psychiatrist on staff to make sure the people using it don't go crazy. If we're talking about a full on, general purpose language, then you might as well start them on Thorazine ahead of time. Otherwise, you risk a programmer going postal.

In short, don't risk your or your coworkers' safety. Just say no to XML as a programming language.

Post reply on HN