About this Book
This book is about implementing domain models by using the paradigms of functional programming—and making the models responsive by using reactive principles like nonblocking computations and asynchronous messaging.
A domain model is about the problem domain, and there are many ways you can implement a solution architecture that delivers the same functionalities as the problem domain model. Traditionally, we’ve seen object-oriented techniques being used while designing domain models. In this book, I use an orthogonal approach—modeling domain behaviors with pure functions and domain entities with algebraic data types, and using immutability as one of the core concerns of the design space. As a reader, you’ll learn about functional design patterns based on algebraic techniques that you’ll be able to reuse directly while implementing domain models of your own.
The book is also about reactive programming—using futures, promises, actors, and streams to ensure that your model is responsive enough and operates on a budget of bounded latency.
I use the Scala programming language for implementing the domain models in the book. Being a resident of the JVM with strong support of object-oriented and functional programming principles, Scala is one of the most widely used languages today. Even so, the core principles that the book discusses are equally applicable for other functional languages like Haskell.