Lean and Functional Domain Modelling

Two day workshop
Marcello Duarte

Lean and Functional Domain Modelling

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.

Rich domain models, inspired by imperative objective-oriented approaches, dominate our industry.
Lean and functional domain models are a compelling alternative. By separating behaviour and state, lean models offer an effective and scalable way to represent units of behaviour. With the advances in cloud-based infrastructures and implementation of microservices architectures, functional models seems to be a compatible, resilience enabling and more obvious choice as the preferred paradigm.

In this workshop we will explore

  • How to reason about selected aspects of a problem domain using a lean domain model from a functional programming paradigm
  • How types can be used as a natural way to represent business constraints alongside smart constructors and functional validation
  • How behaviour can be better composed, and how to keep domain behaviour isolated from application state.

What will you learn in this course

  • Modelling techniques to express selected behaviours in a problem domain, using real world use cases
  • Revision of essential Scala features
  • Model data using algebraic data types, represented in Scala as families of sealed traits and case classes
  • Using functional thinking to approach problem solving
  • Understanding functional patterns for creation, validation, behaviour execution, persistency and state management
  • How to express computation as types and create your own domain algebra
  • Using Property based testing for modelling business constraints
  • Exploring common challenges in real world domain modelling with somebody who has worked with many teams in the field.


Day 1

  • Brief intro to Scala, Scala Repl
  • Functional programming building blocks, basic definitions, pure functions
  • Referential transparency
  • Functions, function literals, function as objects, high order functions
  • Kinds, proper, first order kinds, higher order kinds, genericity
  • Functional patterns, composition, combinators, functors, monands
  • Applicatives, options, either, try, list.

Day 2

  • Lean Domain Modelling. Explicit and Verifiable Domain model algebra. Boundary Contexts
  • Invariants. Creating valid values and objects. Using disjunctions for validation
  • Alternative to Layered Architecture. Separating Boundaries with Monads.State Monad. IO Monad. Monad Transformers. Kleisli Arrows
  • Decoupling from the DB
  • Property Based Testing. Defining domain constraints with Types. Composing the domain algebra.

Expect to get your hands dirty

This is a very hands-on course. All modules are packed with exercises. You will benefit mostly by being alert, attentive and engaged while we work on the exercises (although you will get all solutions at the end).

Who should attend this course?

Developer seeking an alternative way to approach Domain modelling.
Experienced developers with a strong background in software development should be able to follow this workshop and benefit from it.

No experience with Scala is assumed, but strong experience with Java, C# or PHP would be highly beneficial.


You will need to have a laptop with an IDE (like intelliJ, Sublime or Eclipse) or an editor (like Vim or Emacs).

Marcello Duarte

About Marcello Duarte

Marcello has a mixed background of Sociology, Learning and Software Development — a reason why you will often find him between the computer and business people. He has been awarded “Best UK Agile Coach” at the UK Agile Awards, in 2014. In the last 14 years he has trained hundreds of teams across Europe and led teams of agile coaches and learning professionals to support team development for technical organisations.

All workshops by Marcello Duarte

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