Applying Domain-Driven Design with Baker at Cleverbase
Baker is an open source Scala library developed by ING for process orchestration. This is the first in a series of articles about the collaboration between ING as a producer of the library and Cleverbase as a user of it.
What is Cleverbase?
Cleverbase is a Qualified Trust Service Provider, following European regulations and under strict Dutch government supervision. The company enables citizens, professionals and organizations to manage their own digital identity and act with legal force online.
For example, after registering a Cleverbase identity, individuals can sign electronic documents with the same legal force as pen-and-paper signatures. This enables entrepreneurs to join a tender fully from home while in pandemic lockdown (video with English subtitles).
How did it all start with DDD at Cleverbase?
As a scale-up, Cleverbase started to revise its software architecture in 2019 to select patterns and frameworks that enable growth while maintaining high-quality software. While the existing software was secure, compliant, and reactive, lead times for changes had started to increase. It turns out that it is difficult to reuse capabilities in new products, share domain knowledge with new colleagues, and manage complicated integrations with external systems. The team needed to perform the Inverse Conway Maneuver.
A main pillar in the renewed architecture is applying Domain-Driven Design (DDD): an attitude to product development that emphasizes creative collaboration between domain experts and engineers. Together with an event-driven architecture and functional programming style, DDD helps Cleverbase to reduce friction and accidental complexity.
Cleverbase applies DDD and functional programming to backend services in its core domains. A core domain consists of capabilities that are business-differentiating and have high complexity. For example the domains of consent and delegation management. These domains are continuously identified and modelled while switching between concept-linked wiki and living documentation in code.
Cleverbase launched the first service with DDD and Baker at the beginning of 2020.
How does Baker help developers and domain experts at Cleverbase collaborate?
One challenge in DDD is to design and control various business processes, especially when these processes involve multiple systems and actors. As a result, the process functionality gets mixed with process management and persistence logic. This is a problem that Baker solves.
One major driver in the Cleverbase architecture has always been compliance-by-design: since many of the processes implemented in the company are regulated, it is important to involve business and compliance stakeholders early on in the process. From the start, we have used Business Process Modelling Notation (BPMN) to communicate and iterate on functional flows. However, BPMN for software design typically involves manual translation to and from code, which introduces risk.
Baker introduces clear semantics for business process design in software. provides an abstraction in the form of a domain-specific language (DSL) for process recipes. The generated diagrams are easy to read by both engineers and domain experts. It also enables Cleverbase to standardize on the way processes are designed and implemented without compromising with the quality of the software.
Initially, these semantics helped the team iterate on event-driven architecture concepts early in the design phase. By iterating on business processes using the Baker DSL, the team could quickly explore different designs and discover which events mattered the most. The automatic generation of diagrams forces the developers to use meaningful names which aligns the terms that the domain experts use with the application code.
In the next post of the series, we will focus on the mapping of DDD concepts to the Baker DSL for orchestrating business processes.
Till next time!
If you want to learn more about Baker, check out the project on GitHub. This guest post was co-written with Nikola Kasev from ING Labs. If you want to know more about Cleverbase (we’re hiring!), contact Sander Dijkhuis. Thanks to Nick Vintila for introducing Baker and DDD to Cleverbase.