Seven signs YOU may have created a Gratuitous Domain Specific Language

Posted by Tom Moertel Sat, 18 Aug 2007 17:01:00 GMT

Like chromatic, I have watched the recent irrational exuberance for domain-specific languages (DSLs) with bewilderment. In certain quarters of the programming universe, it seems that creating DSLs is nearly a rite of passage. The problem is, more and more of these DSLs appear to have been created mainly because, well, DSLs are cool these days, even if less “novel” solutions probably would have been more sensible.

Whereas chromatic unhesitatingly confronted the madness head-on, I have so far managed to avoid the fray. Sure, I’ve asked the occasional probing question of the DSL enthusiast, but mostly my reaction has been limited to standing back and staring in mute amazement at the runaway Domain-Specific Fun-Time Language Train, screaming down the tracks, destined for its inevitable high-speed derailment into what I can only expect will be a bridge abutment. But I’m starting to get the feeling that some of the train’s passengers are aboard because they think it’s the Right Thing To Do Train, so maybe it’s time to throw in my two cents.

To set the record straight, I don’t have anything against DSLs, embedded or otherwise. (I have created my fair share, some of which are actually useful.) No, my concern is limited strictly to the rise of the Gratuitous DSL. So let’s talk about it.

The reason – the right reason – for creating a DSL is because it ultimately lowers the cost of solving problems. If, then, you create a DSL and the cost of solving your problems does not go down, why did you create it? Think about it. Creating a DSL is an expensive proposition. Making people learn your DSL’s syntax, semantics, and underlying domain is a lot to ask – it’s costly. If you do ask, if you do make the imposition, you had better be sure your DSL pays its bills.

But what if your DSL turns out to be a deadbeat? What if using your DSL doesn’t lower the cost of solving problems? Well, guess what? You have created a Gratuitous Domain Specific Language.

Still unsure of whether you’re on the DSL Train for the wrong reason? No problem. Just take this simple, seven-step test:

Seven signs you may have created a Gratuitous Domain Specific Language (GDSL)

  1. You can’t actually explain what a DSL is.
  2. For your DSL, you can’t explain what the domain is.
  3. You have a hard time explaining the DSL’s syntax and semantics.
  4. You have a hard time explaining how the DSL interacts with the language it is embedded in. (For embedded DSLs only.)
  5. A vanilla library API would have captured the domain’s semantics without awkwardness.
  6. It’s easier to express complex domain concepts in general-purpose code than in your DSL.
  7. Your colleagues have a hard time writing things in your DSL.

Did more than a few of the statements ring true? If so, take a bow. You are the proud creator of a Gratuitous DSL!1

Even so, it’s not too late. You can always hop off the DSL Train at the next stop.

(Note for the humor-impaired: This post is meant to be interpreted in tongue-in-cheek fashion.)


1. Rationale for the Seven Signs. Signs 1–4 suggest that your DSL may not even be a DSL, so calling it a DSL is gratuitous. Signs 4–7 suggest that, though your DSL may be real, it may not be paying the bills; thus, creating it and foisting it upon the world was likely gratuitous.

Update: minor edit for clarity.

Update 2008-03-22: edits for clarity.

Posted in ,
Tags , , , , ,
9 comments
no trackbacks
Reddit Delicious

Lowering the bar for over a decade

Posted by Tom Moertel Sat, 04 Nov 2006 21:31:00 GMT

I was roaming through some old files today and stumbled upon a copy of my first web site, called, laughably enough, “The TomZone.” I am not kidding.

You think I’m making this stuff up? Well, feast your eyes on this:

Oh, the horror!

As if that wasn’t bad enough, I scrolled down to the footer and saw this: “Revised: 22 Feb 1996:

A less-horrifying screen cap of my old, old web site.

1996! That’s nuts! I’ve been bringing down the quality of the Web for over a decade? It doesn’t seem possible. And yet it’s true: this crap was unleashed upon unsuspecting Web “surfers” ten years ago.

And it’s been going downhill since.

Posted in
Tags , , ,
1 comment
no trackbacks
Reddit Delicious

My code is "so clever as to be stupid"

Posted by Tom Moertel Fri, 16 Jun 2006 12:21:00 GMT

In Port Scanning Shootout, author “cavedave” provides a mini-review of my Concurrent port scanner in Haskell. The thing is, I am not sure what to make of it:

50 lines of indentation balancing monadic grappling goodness. Considering I started this quest after seeing this code and thinking it was good, in retrospect it seems very big and not very clever, or at least so clever as to be stupid.

I am struck by the last statement. It seems the author is channeling the timeless David St. Hubbins, who said, “It’s such a fine line between stupid, and clever.”

Words to live by, if you ask me.   ;-)

Posted in , , ,
no comments
no trackbacks
Reddit Delicious