Language Oriented Programming

Introduction

Traditional programming practice is to use an off-the-shelf general purpose programming languages such as Java and C++ to implement solutions.  Language Oriented Programming (LOP) involves the intermediate step of defining Domain Specific Languages (DSLs) which are then used to implement the solution.  As the name suggests, a DSL has language constructs that are orientated towards a specific problem space.  A DSL can be seen as any language that is not general purpose - this may be domain specific as the acronym suggests, but may instead be technology specific.  An example of a true domain specific language is one that supports the programming of financial derivative rules and would contain constructs that are particular to the derivative market such as forwards, options and swaps.  An example of a technology specific language is one that is geared towards developing GUIs and would contain constructs relating to widgets and event handling among others.

Programs written in DSLs (both domain specific and technology specific) only contain details relevant to the domain or technology in question - everything else is instead contained in the language itself. The absence of irrelevant details enables practitioners to more accurately and more quickly translate their conceptual solution into a program.  Because DSLs only contain relevant detail, they are effectively limit what can be expressed and therefore guide the user.  DSLs are also domain/technology aware and know what is and is not permitted, so the financial derivatives language, for example, make it impossible for certain contracts to be expressed simply because they do not make sense.

The history of programming languages evolution has involved moving away from how the machine represents programs (i.e. assembler) to how humans conceptualize them.  Contemporary languages like Java are perhaps as abstract from the machine as is possible while still remaining general purpose.  The next logical step in this progression are DSLs which by their nature are going to have some level of specifity to the application being constructed.  LOP is concerned with giving users the mechanism to define DSLs or to extend existing ones.  LOP is enabled by XMF because it is a language for defining languages.  It contains an array of mechanisms which support the process of defining and using industrial strength DSLs.

Model Driven Architecture (MDA)

The Model Driven Architecture (MDA) is an OMG initiative which abstracts from implementation technology by designing systems using modeling languages such as UML.  The principle is that a system can be targeted to multiple implementation platforms.   The challenge with translating UML to implementation technology is akin to that of translating programming languages, namely that their general purpose nature means that the languages are large and any translation will also be necessarily large.  DSLs are a more appropriate platform for MDA than general purpose languages/notations, since what can be expressed in a DSL is by comparison much smaller, making it realistic to define translations to multiple technology targets.

For details on a practical approach to Language Oriented Programming, you can download the book Applied Metamodelling : A Foundation For Language Driven Development.


Language Driven Development

Medium and large scale software development projects require lots of different domain expertise to engineer.  A full financial derivative system may involve languages that take into account not only the specification of the derivatives, but the GUI, data storage interfaces, rules about security and many others.  These types of systems need to be specified by a number of  (potentially off the shelf) DSLs each capturing a unique facet of the system and which collectively specify the complete system.  Language Driven Development (LDD) is then the process by which LOP and DSLs are used to engineer medium and large development projects.  When DSLs are used on this scale the advantages and costs savings can be significant.  XMF is designed to support multiple DSLs used together in this way, DSLs can either be woven together so DSLs are embedded within each other, or DSLs can be separated into modules so that different domain concerns are partitioned from each other but are semantic related.

In the coming months Ceteva will produce more materials detailing an approach to LDD and how XMF can be used to support this approach.