DDD Europe 2023
DDD and FP Can't Be Friends - Yet
Henning (dedicated to DDD) and Mike (ferociously FP since the 80s) agree on all the fundamentals of software architecture, but when it comes to designing models, they can't seem to find common ground. DDD and FP folks like to congratulate themselves on how well they go together – how FP modeling techniques complement DDD models, or how DDD concepts are really FP in disguise. However, much work remains to unify these two worlds:
- DDD folks like to use the ubiquitous concrete language of the application domain, whereas FP folks like abstractions and the terminology that goes with it. Mixing the two results in inconsistent or contradictory vocabulary.
- While both camps prefer operation-rich models, the approaches to designing these operations are incompatible. Specifically, the OO influence of DDD tilts DDD models towards the OO idea of having the objects populating the domain be encapsulated and thus isolated, whereas in FP this encapsulation is an emergent (or not emergent) phenomenon. .
- DDD’s tactical design is inherently stateful, and FP is inherently stateless. This naturally leads to very different approaches to interface design, and more importantly, to the use of types and their relationship to the ubiquitous language. Moreover, this results in fundamental differences in the division between entities and value objects. Note that this is the case even when Tactical DDD is expressed in functional languages, as the means of expression change, but the fundamental approach is the same.
- Even more fundamentally, DDD focuses on modeling the domain, whereas FP focuses on the human perception of the domain – this might seem like an esoteric difference, but has pervasive practical impact. Thus, to reap the full potential of combining DDD and FP, we first need to recognize the differences. While DDD has much to teach FP about relating the domain language to the code, it can learn from FP its extensive set of techniques for turning information into data as well as the judicious use of abstraction. Henning and Mike will highlight how DDD and FP approaches to design differ, and offer possible approaches to unifying both for mutual gain and insight.
Date & Venue
09 June 2023 | 15:30 - 16:20
Amsterdam | Theatre de Meervaart