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.
Program
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.
Requirements
You will need to have a laptop with an IDE (like intelliJ, Sublime or Eclipse) or an editor (like Vim or
Emacs).