A DSL (domain-specific language) is a language designed for a business or industry domain such as health care, finance, or insurance. It defines processing in terms of the nouns and verbs of your business rather than in terms of a pure computer language.
In most cases, domain-specific languages look like stripped-down versions of English that incorporate business jargon. DSLs are especially powerful when used with a rules engine -- and most rules engines support some kind of DSL system.
[ Also on InfoWorld: Andrew Oliver embraces the programming language explosion. | Learn how to work smarter, not harder with InfoWorld's roundup of all the tips and trends programmers need to know in the Developers' Survival Guide. Download the PDF today! | Keep up with the latest developer news with InfoWorld's Developer World newsletter. ]
The following is an example of a DSL used with Drools, a popular Java-based rules engine:
rule "CheeseType"
when
Cheese is of type "stilton"
then
DoSomething
End
Compare this to the equivalent Java syntax:
if (cheese.getType().equals(Cheese.TYPE_STILTON)) {
doSomething()
}
A key advantage to this type of DSL is that business analysts who speak the jargon of the business, but who are not necessarily programmers, can write business rules on their own. On the other hand, programmers who need to know a lot about the business (but who are not necessarily qualified to determine business rules) can focus on the overall system.
Laying the groundwork for DSLs
DSLs disrupt the conventional software development workflow: A subject matter expert (SME) describes a business concept to a developer, who may not fully understand it, but who then implements it in a language the SME can't read. With DSLs, the developer works with SMEs to define a language specification; the SME then describes the business rules in the new language.







