EARLY BIRD UNTIL OCTOBER 17: ✓ Save up to €100 ✓ 10% Team Discount ✓ 15% CPSA Discount

Conference program

iSAQB Software Architecture Gathering 2024

Register now

  • Session
  • Intermediate
  • 16 Nov 2022
  • 12:15-13:00
  • Room 2

Getting FP Into DDD – For Real

by Mike Sperber, Benedikt Stemmildt

Functional-programming acolytes usually advocate an FP-first approach to doing software projects. However, the reality on the ground is often different: Many projects want to benefit from functional programming, but have an existing OO codebase with paradigms and conventions that are at odds with “FP purity”. This talk describes an ongoing cooperation between Blume2000 (firmly OO) and Active Group (pure FP) to get the most beneficial bits from functional programming into an existing hexagonal/DDD architecture written in Kotlin with Spring Boot. The project has produced some successes:
– applicative-based validation
– free monads for better domain/port separation
– functional dependency injection, also in conjunction with the free monads
The project also has produced some areas of friction – notably the strict domain/technology separation of the hexagonal model helps developers find their way around, vs. the more fine-grained approach to abstraction taken in the functional core/imperative shell architecture preferred by the FP folks. Moreover, the annotation-based approach to system assembly implemented by Spring Boot clashes with the more object-oriented approach favored by functional programmers. We’ll dive right in, get our hands dirty, and report on how it’s done.