Domain Specific Languages for Tax & Payroll Calculation
We want to collect some examples of important organizations which have used a particular approach to software development to change the way in which they developed software for tax calculations.
This approach is based on Domain Specific Languages (DSLs). DSLs permit better collaborations between experts in tax system and payroll calculation and developers. It results in faster development cycles, reduced number of errors, and reduced development costs.
We will see four different cases:
How I can learn more?
What are Domain Specific Languages?
A Domain Specific Language for tax and payroll calculations permits experts to define calculation rules such as tax brackets, rules for deductions, withholding regulations, and so on.
Think of a specialized version of Excel, which understands the domain and can guide the user, avoiding a lot of possible mistakes and simplifying the work.
In traditional software development, experts have to explain to analysts concepts, analysts write them down into large documents, which are implemented by software developers. This whole approach requires a lot of coordination and causes issues, as the developers are not accountants, and the accountants are not developers. Development cycles are long and misunderstandings typically emerge only after developers have completed their work.
DSLs change all of that, making it possible for experts and developers to collaborate much more efficiently, with everyone working on what they can do best.
A leading company in Italy for tax consultants
We have worked with a leading Italian company in the software for tax consultants market.
This company has over 40 years of history. They started developing software for tax consultants a very long time ago. Decades ago they made a choice that has been paying off: they developed a proprietary language to define specific concepts related to their domain. So their language had support for concepts like quarters and tax brackets, which are not typically part of a common programming language.
Why is this important?
Because code written in their proprietary language survived across several technological changes. The competitors that shared such a long history and they did have to regularly rewrite their software over time.
This company instead wrote originally applications that had a terminal interface, do you remember the 80×25 screens? Over time they needed to replace the software with desktop GUIs for Windows machines. And then 10-15 years later it came the time to move to web applications.
And they did, but without the need to rewrite the logic for tax calculations. How is that possible? They simply worked on their DSL engine and adapted it to produce desktop applications first and web applications later.
This meant that they did not have to stop, and redo their entire core product, with a huge investment and a significant slowdown in development.
In their case adopting a DSL for developing the solution meant the knowledge poured by tax and payroll experts was still reusable even when technologies changed.
This is a major difference with traditional software development, where software has to be rewritten to accommodate major technological transformations.
A large multinational, present in over 50 countries
A few years ago we worked with a large multinational that was producing a wide range of software for tax consultants, accountants, and payroll processing.
This company was and is still present in over 50 countries. And some of those countries presented different rules for different areas: think about the federal states like the USA or Germany, with different taxes for each state. Or countries like France, with special rules for “Metropolitan France” and their territories far away from Europe.
These companies have to face very significant challenges due to their business. On the basis of a single platform, they need to have specialists from all over the world define the specific rules for each jurisdiction, and keep it up-to-date year after year. Tackling these challenges with traditional development techniques can prove very expensive.
This company therefore developed its own language, which specialists can use autonomously to define the logic for tax calculation and verify it. Different experts all over the world can get easily accustomed to it in a matter of hours.
This reduced the costs for making experts and developers communicate, sped up development, and reduced a lot of errors as less misunderstandings are possible.
In this case a DSL permitted to have a scalable approach to capture knowledge about tax calculations and have this knowledge integrated with the software platform developed by the technical team.
The Dutch Tax and Customs Administration (Belastingdienst)
The Dutch Tax and Customs Administration has to face one important challenge: to update their software every year, based on the changes in fiscal legislation.
One has therefore to study the code tax (Belasting Wetten), examine the difference with the support of tax and legal experts, and consequently update the software in a short time.
If we consider that hundreds of billions of Euros are at stake, as the tax returns of millions of citizens are processed, we can understand the importance of getting calculations exactly right. As part of their system named ALEF, the Dutch Tax Agency have developed two DSLs called RegelSpraak and DataSpraak.
With RegelSpraak, rules for tax calculations can be defined, while with DataSpraak data and rules for processing it can be defined. Citing Diederik Dulfer, Architect Business Rules Management at Dutch Tax and Customs Administration, “MDSE is the future and the Tax and Customs Administration is already well on its way!”.
In this case MDSE stands for Model Driven Software Engineering, a broader set of techniques which includes DSLs.
In the case of the Dutch Tax Administration, because of the DSL it is very easy to trace the code written by legal experts to the original laws, and when laws are modified, changes in the DSL code can be applied with a limited effort and with confidence.
Datev, a German cooperative with over 400,000 customers
The cooperative DATEV eG stands for data processing and has more than 400.000 customers. Founded in 1966, the organization now has about 8.100 employees, working in its headquarters in Nuremberg and 23 subsidiaries in Germany.
Over 13 million payroll slips are processed every month by DateV
DateV has interesting challenges, like for example supporting the ability to recalculate payslips considering the laws and regulations that were valid at that point in time.
Most calculations have also to take into account not only regulations but also data changes, like for example salaries being augmented during the year.
Temporal dimensions are difficult to track in traditional software development but are addressed much more easily in the DSLs.
Another advantage of using the DSL is the possibility to define the logic once and then generate code out of it, so that certain checks can be performed both on the server side and on the client side, providing a better user experience.
The DSL proved very valuable during the pandemics: as rules changed frequently, the corresponding DSL code could be adapted much more easily and faster than code written in traditional programming languages.
The approach permitted also to better separate concerns: developers could focus on technical aspects, like the cloud infrastructure, while experts were able to define rules for tax and payroll calculations autonomously.
It should also be noted that the DSL can use terms in the natural language which is most convenient for the users. For example German or Italian. Typical programming languages are instead restricted to English keywords.
How I can learn more?
Do you have questions?
- A Domain-Specific Language for Payroll Calculations: an Experience Report from DATEV
- MPS Talk Series: A DSL for Payroll Calculations by DATEV, by Marcel Riedel
- Domain-specific modelling for the Dutch Tax Agency: how MDE enabled civil servants to program tax law