This white paper is aimed at introducing the concept of DSL to the business/non-technical person and explaining how the use of DSLs can greatly increase the productivity of developers and make programming changes faster with less risk to the business. Let’s start with the acronym DSL; it stands for Domain Specific Language. In very simple terms DSL is a programming language that is meant to solve problems and design solutions in a given problem domain.
A DSL, in contrast to a General Programing Language (GPL), can’t be used outside the domain it was designed for. For instance, the DSL used by CoreCard Software was created specifically to reduce the time required to develop and make changes to its highly sophisticated financial transaction software products. DSL provides a meaningful level of abstraction to the programmer such that he/she does not have to deal with unnecessary details in executing the tasks for the domain. Some such abstractions provided by CoreCard’s DSL are Multi-currency support, interface to DBMS, PCI security compliance, Account hierarchy and Aging chains.
If the term “abstraction” seems too abstract, the following example may help. In a financial account management system, one can transfer an account from one financial product (such as “90 days same-as-cash”) to another (such as “revolving credit limit”). This can be done by creating a new account under the destination product, personalizing it with account holder information, and transferring all balances, transactions, payments, status flags and other details to the new account. Alternatively, you can create an imaginary entity/object that has all the information needed to complete the account transfer and can invoke all individual processes needed to do so. Let us call this entity “Transfer account to new product”. What we have done here is abstraction. Transferring an account to a new product now merely requires invoking the abstract entity “Transfer account to new product” without worrying about any individual processes, entities or other details.
DSLs are not a new concept; they have always existed in the form of special purpose languages. But they are more practical now due to the availability of tools for modeling and creating DSLs. In fact, you might have used a DSL without being aware of it. Excel spreadsheets and SQL are two very powerful and widely used Domain Specific Languages. Here is how: Excel spreadsheets have built in functions for all manipulations that you might want to do on tabular data. The user need not go into details of how these functions work or write step by step instructions, but only needs to know which ones to use for what purpose (Microsoft has done a good job naming the functions in user friendly fashion). Another key trait that makes Excel instructions domain specific is that they can’t be used elsewhere. Of course, similar functions can be written in any GPL but they won’t be single line instructions or might not be as easy to understand as in Excel. Similarly, SQL is a handy tool/language for accessing, managing and updating relational databases only. It can’t be used elsewhere. Once again, any GPL can do the job, but it might require several lines of code to replace a single SQL command. Other widely used examples of horizontal DSLs are HTML, WS* standards and Business Process Execution language. Some other DSLs that programmers might be familiar with are Ant, Rake, Make, CSS, RSpec.
Excel and SQL are examples of DSLs for a horizontal domain which are applicable across a large range of applications. Vertical DSLs, by their nature, are much narrower. They apply to a specific industry vertical or to a small problem within an industry. Since most vertical DSLs are developed within companies as their intellectual property, you might not have come across them. Some vertical DSLs used by big corporations are Python (Nokia), East-ADL (Volvo), Amphion (NASA), SLL (Lucent) and Vampire (Philips, for medical applications).
To download the Introducing the Concept of DSL to a Non-Technical Person white paper, visit, CoreCard Downloads