Functional and Reactive Domain Modeling

Three day workshop with Debasish Ghosh

Functional and Reactive Domain Modeling

No dates are scheduled for this workshop. Let us know if you think we should organize it near you, or if you'd like to book it on premise in your organisation.

Domain modeling has been the cornerstone of any application design and implementation. Domain driven design has been one of the primary ways of domain modeling that focuses on the problem domain and treats problem domain artifacts as first class citizens of the modeling exercise. However the more popular domain driven design learning resources are based on object-oriented paradigms of Java or C#. Traditional mainstream languages like Java and C# primarily encourage modeling with mutable objects and most of the current architectures in domain modeling adopt the same approach. Shared mutable state is an anti-pattern and leads to brittle models especially in the face of concurrency.

Functional programming encourages design using pure functions, much like mathematics. The function depends on input and output arguments and does not share any mutable state with the context / environment. This makes functions safe for composition to form larger functions out of smaller ones. In the context of domain modeling, we define domain behaviors using pure functions, which are expression based, compositional and hence easier to reason about.

In this workshop we will discuss approaches of domain modeling using the paradigm of pure functional programming. We will use Scala, that offers the capabilities of functional and OO paradigms. The workshop will demonstrate how to harness both the capabilities of Scala to implement rich and functional domain models.

Debasish Ghosh

Who should sign up

  • If you are an aspiring functional programmer with some working knowledge of Scala and interested to increase your horizons of applying the concepts of FP in designing domain models
  • If you are a practitioner of FP and want to explore the advanced concepts of algebraic modeling using monads, applicatives etc.
  • If you are an OO programmer with some knowledge of Scala and wondering what to expect from FP in Scala

What will you get out of it

Here are some of the ideas that you will get from the workshop:

  • Algebraic domain modeling
  • Expression based programming
  • Importance of interface-first design and decoupling of interface from the implementation
  • Parametricity
  • Patterns of functional programming using algebraic techniques
  • Effects are patterns, side-effects are bugs - How to manage side-effects algebraically
  • Reactive patterns in domain modeling

Format of the workshop

  • 40% theoretical presentations (concepts, FP techniques, patterns, Scala)
  • 40% code walkthroughs demonstrating the above theory
  • 20% hands-on exercises
  • The above percentages can vary depending upon the profile of the participants

Participant Prerequisites

  • Basic understanding of functional programming
  • Basic knowledge of Scala
  • (Brownie Points) Functional programming in Scala


Day 1

  • Introduction to functional domain modeling (with examples from Scala)
    • What is a domain model
    • Introducing Domain Driven Design (DDD)
      • Bounded Context
      • Domain Model Elements
      • Lifecycle of a domain object
      • Ubiquitous language
    • Thinking Functionally about the domain
      • Model behaviors as pure functions
      • Functions operating on data (inverse of how we think of OO)
      • Behavior / Function composition
    • Managing side-effects
  • Introduction to Reactive Domain Modeling
    • The 3+1 view of the reactive model
    • Being responsive in the face of failures
    • Debunking the myth - “My model cannot fail”
  • Functional meets Reactive
    • Reactive and algebraic
  • Hands on examples to continue with the lectures

Day 2

  • Introducing a concrete problem domain model
  • Functional Domain Modeling in Scala - we will use the following features of Scala to implement the above domain model incrementally
    • Algebraic approach to domain modeling
    • Algebraic Data Types (ADTs) and Pattern Matching
    • Composition of functions to implement domain behaviors
    • Role of static types in domain modeling
    • Functional in the small OO in the large
    • Managing effects, failures, latency using reactive patterns
    • Lifecycle patterns of domain objects in the functional world (introduce how to design factories, aggregates, repositories and services using algebraic and functional approach)
  • Hands on examples to continue with the lectures

Day 3

  • Functional Patterns of domain models
    • Introducing common patterns like functor, applicative and monad and how we can use them in designing domain models
    • Evolution of an API with functions, types and patterns
    • Modularization of domain models
  • Hands on examples to continue with the lectures
Debasish Ghosh

About Debasish Ghosh

Programmer, father, husband, avid reader, author, occasional speaker at technology conferences and Seinfeld fanboy. Senior member of ACM and loves spending time with his beautiful family. Passionate about technology and open source, loves functional programming, and has been trying to learn math and machine learning. Authored 2 books published by Manning Publications - Functional and Reactive Domain Modeling (Oct 2016) and DSLs in Action (Oct 2010)

No dates are scheduled for this workshop. Let us know if you think we should organize it near you, or if you'd like to book it on premise in your organisation.

Also check out