Functional Domain-Driven Design and Architecture
Functional Programming (FP) has been around for 40 years, but in the last decade it became more and more popular in the software industry where Object Oriented (OO) technologies have completely dominated. In FP, functions are treated as first-class citizens and provide a powerful abstraction to model domain behaviors in predictable ways.
FP requires immutability, thus helping to design reliable and risk-free domain states. Side effects are controlled and pushed outside of the domain model boundaries which leads to programs having fewer bugs, because they are easier to test and debug.
The declarative nature of FP helps in thinking about what the program is, not how it works. This is the very essence of Domain-Driven Design (DDD) where how is abstracted but a carefully designed domain model describes what domain problem is being solved.
FP principles are not exclusively useful in writing programs but can also be applied to higher level design and architecture to build fully functional systems that are easier to test and reason about.
This workshop teaches you how to think functionally and how to apply FP principles and DDD to effectively craft expressive and rich domain models. Learn how to raise this understanding to a higher level of abstraction and apply the principles to architecture. You’ll learn about Hexagonal, CQRS, Pipes and Filters, Event Sourcing, and Functional Core architecture patterns. You will discover how to integrate Bounded Contexts using events, which are immutable data records that can be used as messages.
You don’t need to understand advanced concepts of FP, such as functors, applicatives and monads.
3 Half-Day Sessions
- Understand Functional Programming concepts
- Introduction to Domain-Driven Design
- Learn how to designing rich domain models using immutable types and functions
- Learn how to decouple business logic from side effects
- Compose smaller pieces into bigger programs and systems
- Deep exploration of different architectural patterns that helps with designing functional systems such as CQRS, Event Sourcing and Event Driven Architecture.
Functional Programming and Domain-Driven Design
The first day builds your foundation of FP and DDD. Learn how to design immutability, referential transparency, and pure functions, including how to prevent effects and side effects. Gain a working knowledge of essential DDD, and how it is expressed with FP to solve real-world, complex problems.
- What is functional programming?
- How do you think functionally when solving business problems?
- Strategic design
- Tactical design
- Discovering the domain using business events
- Learn with EventStorming by thinking in events to explore the business domain
- Model business solutions with immutable data records and pure functions
- Representing concepts with immutable types
- Modeling side-effect-free behaviors with functions
- Enforcing business invariants
- Preventing effects and side-effects
Day two adds to your foundational knowledge by featuring functional architecture patterns. This helps you understand how to build business-driven systems using FP principles to increase your success with complex domains.
- Pipes and Filters
- Functional Core
- CQRS and Event Sourcing
- Understanding relationships between Bounded Contexts
- Driving out purposeful services (i.e. microservices)
- Composing behaviors and buildinging workflows with functions
- Understanding subsystem relationships with Context Mapping
- Communicating between Bounded Contexts
- Applying Domain Events for message-driven integrations
- Designing DDD Open-Host Services, Published Languages, and Anticorruption Layers
Functional Architecture Implementation
The third day puts the knowledge acquired in previous days into practice. Design services end-to-end that are bug-free, using FP and DDD. You will broaden your skills to encompass multiple subsystems and build a fully functional system architecture.
Exercise: Implementing Insurance Underwriting Bounded Context
Put into practice what you have already learned with this Hands-on FP and DDD Bounded Context implementation with F# and Kotlin.
– event sourced aggregate
– side-effect-free domain
– longrunning workflow
– integrate with other bounded contexts