tags:

views:

201

answers:

6

I guess I am looking for some kind of Intro and see if anybody have used it. Are there any particular advantages of using it?

Wikipedia: "domain-specific language (DSL) is a programming language or specification language dedicated to a particular problem domain, a particular problem representation technique, and/or a particular solution technique."

Can anybody give any specific examples of how you have implemented or how it can be useful in a given scenario?

+1  A: 

I think it's a language suited to solve problems for a specific domain. It could be some rule-processing language or service description language.

An opposite to a domain specific language (DSL) is a general-purpose language.

Michael Damatov
See also: http://en.wikipedia.org/wiki/Domain-specific_programming_language
altCognito
I'd also love to know what the downvotes were for...
Michael Damatov
A: 

A DSL is a good way to develop a language to be used by non-programmers. For example, if you have a DSL for the finance people in a company, then rather than programming to their specification you can just let them write the program they want done. Then, if it is too slow then you can take what they wrote that works as they want, write it in a compiled language to speed it up.

James Black
+7  A: 

A domain specific language is a language that's written to deal witha specific domain or set of concerns. There are a lot of them around, like make, ant, and rake for describing software builds, or lexx and yacc for language construction. In recent years, they've become popular as some things have combined to make them easier to build. Big among those things has been the increasing popularity of Ruby, which has several features that make it easy to build new DSLs.

Martin Fowler is a big proponent of the idea, as here.

Charlie Martin
I'd love to know what the downvote was for...
Charlie Martin
+1  A: 

(addressing the crux of the question)

I think the first time I saw DSL somewhere and its definition as "domain specific language" I also thought it was a particular, concrete language that I just hadn't heard about -- but, no, its a general term for languages that are tailored to a particular application area.

Ironically, if you had just heard about TCL as a "tool command language" you might think, like DSLs, that there would be lots of TCLs for various tools -- but, no, its the specific name of a particular scripting language.

rndmcnlly
A: 

You can think of DSL as overly complex arguments for functions written in a more general programming language. The real programming language parses the DSL code and does something with it, typically, the DSL code only focuses on the what you want to do, and the larger system figures out the how.

Examples of DSL include all query languages (SQL, XPath, ...), all template languages (Django, Smarty, ...), shell scripts, specially including stuff like twill, a command driven web browser (mostly used for automated test), data storage and exchange languages (XML, YAML, ...), and document languages like LaTex, HTML or CSS.

Some languages with very flexible syntax like TCL and Lisp build their DSL directly into the language... when possible. The majority or languages use strings, usually loaded from external files.

Are there any particular advantages of using it? Using them for their indented purposes is very advantageous to the point you will turn to them without knowing, just like you have been using (I pressume) SQL or HTML without thinking of them as a DSL.

I'll dare saying there are enough DSL out there for any sort of application you may need, you almost certainly don't need to learn how to write your own one.

rgz
A: 

I don’t know, but I’m going to ask my boss tomorrow if I can start re-writing our internal CRM system in DSL. It’s got to be easier than the Ruby-to-Scala port I’m doing at the moment.

Paul D. Waite