Domain-Specific Language

In computer science, a domain-specific language (DSL) is a computer language designed for a specific application domain. Application domains consist of the set of functionality, requirements, and terminology for a particular application. In contrast with general-purpose languages (GPLs) like the programming languages of C or Python or the markup language XML, DSLs are small programming languages because they cover only those features and functionalities required for their specific purpose. The line between the two can blur, however. PostScript fits the requirements of a GPL but in actual practice has found use almost exclusively in page description. Perl was designed as a DSL for text processing but quickly attracted interest as a GPL.

Domain-specific language is a major part of domain engineering, the science (in software development) of reusing domain knowledge—knowledge about a particular environment in which software operates, or an end to which the software will be used. DSLs are used not only to avoid reinventing the wheel but also to preserve the perfected wheel and continue to use it in new applications. DSLs have the advantage of being more streamlined than GPLs. Also, DSLs, when well-designed, are easier to use and quicker to learn.

Overview

DSLs are often written for business software, and they are designed for specific areas of business operations—such as billing, accounting, bookkeeping, inventory, and the calculation of salaries and benefits. DSLs also may be designed for operations specific to a particular kind of business, such as the tailoring of insurance policies to customers based on specific actuarial data, or the tracking of the development and costs of the disparate elements of a publisher's in-progress projects. The more ubiquitous that software in the running of a business, the more specific DSLs have been developed for narrow areas of application. Early, common business software, which had a much smaller customer base, focused on areas such as accounting and inventory.

An early example of DSL is Logo, an educational programming language designed in 1967 and taught in many schools through the twentieth century. Logo taught LISP-like programming concepts by letting students write programs that would move a cursor called a turtle around the screen and draw lines. (Applications with a robot turtle were also developed.) Later, languages like Mathematica, Maple, and Maxima were developed for spreadsheet mathematics, while GraphViz was developed for graphing. Other languages combine features or commands from GPLs in a simple to use format for a specific purpose, such as the Game Maker Language developed for the Game Maker software package, designed to let users more easily write their own computer games with a combination of C++ and Delphi commands.

One of the most familiar DSLs, taught in some schools as Logo's popularity waned, is HTML, the Hypertext Markup Language still used to encode web pages (though hypertext applications preceded the web). Similar markup languages had been used in word processing applications, and were important in the early days of the Internet.

Bibliography

Fowler, Martin. Domain-Specific Languages. Upper Saddle River: Addison, 2011.

Ghosh, Debasish. DSLs in Action. New York: Manning, 2010.

Parr, Terence. The Definitive ANTLR Reference: Building Domain-Specific Languages. Raleigh: Pragmatic, 2013.

Sadalage, Pramod, and Martin Fowler. NoSQL Distilled: A Brief Guide to the Emerging World of Polyglot Persistence. Upper Saddle River: Addison, 2012.

Vernon, Vaughn. Implementing Domain-Driven Design. Upper Saddle River: Addison, 2013.