What is Domain Specific Language (DSL)?

Introduction: Any programming language is intended to take you so far to solve real world problems. Object oriented language like C# or JAVA is directed to create applications that, solves problems using the generic syntax, allowing one to build components / classes that solves the business problem. DSL on the other hand empowers to develop a layer through quasi syntax (and its corresponding semantics) that solves the business domain problems.

Definition: In essence, DSL is a meta-programming approach (business centered specific programming on top of conventional programming language) that develops a layer of domain specific syntax/components which can be, invoked typically over command line or structured textually through syntax or structured graphically, and hence interpreted through a custom parser. This facilitates a conventional programming language to extend and solve a specific business problem at hand.
Essential: There is an urgent need to build a repository of DSL for any business domain which inherently abstracts the repeating miniscule problems and allows one to flexibly weave the DSL components making it powerful, reusable, well tested over time and extensible.
Popular Examples:
                >UNIX’scommand line (grep/awk/sed) entities that allow one to solve recurring everyday programming problems of data manipulation and can be invoked through scripts and command line.
                >HTML is by itself a configuration (textual/xml) based DSL that allows to solve the rendering hypertext over browsers.
                >CSS is another meta-programming language that allows specifying styles for its kin HTML.
Challenges: There is clearly an overhead in building a foundation of DSL components with economical syntax that greedily solves the business problem at hand.
Note: There are scores of books devoted for DSL running to 100s of pages. But I have made a sincere attempt to capture my understanding both from the theory I have read and practical coding experience.

Leave a comment