Book Review: Domain Modeling Made Functional

Domain Modeling Made Functional


Scott Wlaschin

My Rating

star star star star star
"The best book on Tactical DDD and Domain Modeling"

After ten years of experimenting with a variety of programming languages and styles, I can hand-on-heart tell you that the ideas presented by Scott Wlaschin in Domain Modeling Made Functional represent what I believe is the best way to create clean, clear, robust, and expressive code.

Using a foundation of functional principles - immutable data, side-effect free functions, and function composition - Scott shows how Domain-Driven Design and Functional Programming are a great combination. DDD is not exclusive to OO, and FP isn't just for creating abstract libraries. They are a beautiful combination.

Leveraging the Type System

Where this book is absolutely head-and-shoulders above its competitors, is the sublime guidance on how to leverage type systems for more expressive and reliable code.

If you're coming from an OO background, you are going to be blown away by the power of Algebraic Data Types and pattern matching. The way Scott uses discriminated unions to create workflows which domain experts can understand is unmissable.

It might take a little unlearning of OO concepts such as the Liskov Substitution Principle and Tell Don't Ask, but it's totally worth it.

Following the patterns in this book, not only will you be able to express your domain far more explicitly, you'll also learn how to:

  • Make illegal states un-representable
  • Make the compiler enforce error handling - no more exceptions that bubble and blow up at runtime
  • Wire up dependencies simply without IoC containers
  • Greatly simplify the testing of your code without mocks

I'm New to DDD and I Don't Know F#, Should I Still Read it?

Scott Wlaschin is a unique talent. His ability to teach concepts is really something to behold. If you do not have any experience with DDD or F# it really doesn't matter. This is an intro book, where every concept is presented so clearly and simply that you'll be fine.

On the other hand, even if you are experienced with DDD, if your only experience is with OO you'll benefit greatly from this book. In fact, you should definitely read this book.

When anyone asks me how to do Tactical DDD - creating domain models in code - this is the book and these are the patterns I will be recommending.

You may also like...

Domain Driven Design

Introducing EventStorming

The Phoenix Project

My Books

Designing Autonomous Teams and Services
Patterns, Principles and Practices of Domain-Driven Design