Domänenspezifische Sprachen - DSLs

Domain-specific languages specialized to particular application domains

Tailored languages to handle unique challenges

Domain-specific languages, or DSLs, are widely used to enable the modeling of complex systems and not just by software programmers.

Sometimes, a challenge must be solved for which a program needs to be written. However, the programming language or approach selected seems to get in the way of solving the task. If this is the situation you find yourself in, it may be time to consider a domain-specific language.

Domain-specific languages versus general-purpose languages

What is a DSL?

To explain what a domain-specific language is, it is worth first considering the role and capabilities of a general-purpose language. Programming languages like C, Java, and Rust are designed to be capable of undertaking any task a programmer tackles. When needed, they can tackle the same task in different ways. For example, a math function, like the Fibonacci series, may be available as a library function, but it may also be programmed using loops or recursion. General-purpose languages are used to create software that may control a coffee machine, analyze medical images, or transmit images of Mars to earth.

By comparison, domain-specific languages are quite restrictive, and it is the domain for which the language is developed that defines its capabilities. And, unlike general-purpose languages, domain-specific languages are often used by non-programmers. Typically, a domain expert, such as an actuary or physicist, will work with a team of software developers to create a domain-specific language. Much of the work will initially involve explaining the domain and refining the nomenclature used. With this clarified, a language is developed that allows problems in the domain to be tackled efficiently, even if the users are not typical software programmers.

Ultimately, DSLs support their users in a wide range of tasks including analyzing and evaluating information, performing consistency checks, and generating documentation or input for other tools.

Application examples for DSLs

Where are DSLs used?

DSLs are used anywhere and everywhere, but they don’t make sense in every situation. Firstly, a good sign that a domain-specific language is required is when users rely on Excel spreadsheets or diagrams in PowerPoint to document and complete tasks. Alternatively, they may have extended a language, such as C, with a scripting language. Secondly, the task must either be suitably complicated, warranting its own language, or be an integral part of your business. A DSL can then deliver cost savings and efficiency improvements. DSLs developed for specific use cases include test environments for embedded systems, modeling complex insurance products for actuaries, large machines for physicists, or modeling of complex communication satellites.

The DSL development process

How are DSLs developed?

The first step in the development process of a domain-specific language is to explore the problem with the domain experts. This is typically undertaken in one or more meetings or even workshops. During this process, the task’s scope, the domain’s peculiarities, and the team’s needs are refined. By the end of the sessions, the new language and how it will be used are typically visible. There will also be clarity on whether the DSL should be text-based or visual.

Next is the development of the first prototypes of the language. As this progresses, initial assessments can be made regarding the improvements it will provide to the business process and whether the hoped-for efficiencies can be attained.

With the green light given, the software team develops the domain-specific language in a series of sprints, allowing the domain experts to evaluate its performance regularly. During this process, plans are made to ensure the DSL can be maintained and extended, either by the client’s team or by PROTOS.

Examples of domain-specific languages

DSLs that have been and are being developed by PROTOS

The development team at PROTOS have been involved in a range of projects, some commercial, and some open-source, in recent years. These have delivered various DSLs that are in regular use, including:

Other projects have covered:

  • Modeling of automotive in-vehicle infotainment (IVI) systems.
  • Defining the optimal system design of communication satellites.
  • Handling documentation and architecture designs for system engineers for vehicle platforms, covering requirements management.

DSL project from beginning to end

Engaging with PROTOS on DSL development

DSL projects take many forms, from “from scratch” development to supporting teams in their development and extension of existing DSLs. In order to assess the status and needs of new customers, we like to start with an initial meeting to understand the scope, timeframe, and requirements. From here, it’s possible to plan the next steps. If you believe a DSL is required but have yet to engage in such a project, we also offer a wide range of seminars that help determine the optimal course of action. We’re always happy to speak in person, so drop us a line using the contact form below, and we’ll be in touch.

The PROTOS Software team has developed many DSLs for their customers and trained them in the use of Xtext and Xtend and even JetBrains MPS, enabling them create their own DSLs and code generators.

If you’d like to move away from developing software concepts using general-purpose languages or inappropriate tools, contact us using the form below to discover how DSLs can help your development team.