You want increased customer satisfaction, faster development cycles, and less wasted work. Domain-driven design (DDD) combined with functional programming is the innovative combo that will get you there. In this pragmatic, down-to-earth guide, you'll see how applying the core principles of functional programming can result in software designs that model real-world requirements both elegantly and concisely - often more so than an object-oriented approach. Practical examples in the open-source F# functional language, and examples from familiar business domains, show you how to apply these techniques to build software that is business-focused, flexible, and high quality. Domain-driven design is a well-established approach to designing software that ensures that domain experts and developers work together effectively to create high-quality software. This book is the first to combine DDD with techniques from statically typed functional programming. This book is perfect for newcomers to DDD or functional programming - all the techniques you need will be introduced and explained. Model a complex domain accurately using the F# type system, creating compilable code that is also readable documentation---ensuring that the code and design never get out of sync. Encode business rules in the design so that you have "compile-time unit tests," and eliminate many potential bugs by making illegal states unrepresentable. Assemble a series of small, testable functions into a complete use case, and compose these individual scenarios into a large-scale design. Discover why the combination of functional programming and DDD leads naturally to service-oriented and hexagonal architectures. Finally, create a functional domain model that works with traditional databases, NoSQL, and event stores, and safely expose your domain via a website or API. Solve real problems by focusing on real-world requirements for your software. What You The code in this book is designed to be run interactively on Windows, Mac and Linux. You will need a recent version of F# (4.0 or greater), and the appropriate .NET runtime for your platform. Full installation instructions for all platforms at fsharp.org.
If you'd like to understand why F# (or statically typed functional programming in general) is useful for everyday 'enterprise' development, then this is the book for you.
You don't have to know F# already. While this isn't an introduction to the F# programming language as such, Scott gives you enough of an introduction that you'll be able to understand what's going on. Instead of using half the book to introduce the language, he shows you just enough, and then he keeps the example code in the book simple. Keeping code simple is good advice anyway, so don't worry that he's cheating. (I have to admit that I write the above paragraph based on my best-effort guess at how easy it is to understand the book if you've never seen F# before; I've been writing F# code for years.)
It's clear throughout the book that Scott has decades of experience with programming. Not only does he address various concerns that you, the reader, could have, but he also shows how to design in a style that will be able to deal with changing requirements, and so on.
To be clear, this isn't a book for everyone. The book starts with an introduction to Domain-Driven Design (DDD) which, I suppose, is useful if you know little about the subject. Everything in that first part of the book is right and proper, but I didn't learn anything that I didn't already know.
I wholeheartedly recommend this book to people who are new to either F#, statically typed functional programming, or DDD. If you've already had more than fleeting encounters with these topics, however, you're unlikely to learn much. It's a beginners' book, although, paradoxically, it's aimed at developers with some years of 'enterprise' development experience.
Based on Beta 1.0 - 2 final chapters still missing.
PragProg doesn't disappoint, but as I've never read any decent book on functional modeling, my initial enthusiasm was rather limited. Additionally, I'm not really keen on F# (as a language) - its OCaml inspiration doesn't impress me, I generally try to avoid F-OO hybrids.
And then, enters Scott Wlaschin. Needless to say, he's not an anonymous person (quite far from that - https://fsharpforfunandprofit.com/), but still - this guy has just accomplished impossible - he has written absolutely fabulous book on Functional Modeling!
Book is very practical - how to compose functionality, how to build models, how to map between models & DTOs, how to compose logic, how the critical DDD concepts (like bounded contexts or aggregates) map to FP, how to deal with error handling.
This is NOT a hardcore FP book - it describes some critical concepts like binding or mapping, there's even a simplified description of a monad, but that's all. Don't expect functors or free monads - Scott doesn't try describing all functional composition patterns. I don't find it a problem - it makes book very approachable & easy to get through. Even at Beta stage, it's a pleasure to read.
Ok, so there's one were this girl — I knew she have a husband, but also I knew she wasn't fond of the sucker. She was kinda chubby but qute; and also that was the kind of chubby that makes one's breast grow along with the fat percentage. So she invited me home and we fucked. Several times. And it was fine. But it seemed to me like the fact that it happened mattered for here more than enjoyment or our friendship itself.
Now I know how girls feel when guy immediately starts to dress up after he came. And you can know the feeling too if you'd read the book.
It's not about F# per se, although it can be used as introduction to language. It's not about developing process in the language — it's just a guy sharing his view of solving problems with software. It's not bad, nor great — it just exists.
And you wouldn't remember it after you bring home another book tomorrow.
It's really impressive how Domain-Driven Design matches Functional Programming, especially with a typed language as F#. I used to think that DDD made more sense to be applied with OOP, but now I think the opposite. The book is super easy to read. It contains lots of practical examples using different workflows of a hypothetical (but realistic) domain. It gives you a good sense of how it would be to apply DDD in a real application by covering use cases from the user input until storing them in a database. One of my favourites about DDD!
That's a great book on software design which I would recommend to any developer, no matter of programming language preferences. Scott has a rare ability to explain complex stuff in approachable way through analogies and examples.
I found some code samples quite trivial and mundane for a book, thus 4 stars.
In just a mere 260 pages Scott does a terrific job implementing a real life order processing system in a DDD way starting from requirements gathering , implementation and even further development , explaining along the way DDD concepts (domains, bounded contexts , adapters, side effects) as well as functional programming with F# (including functors , applicatives , monads ) .
While the code snippets and the explanations are great what makes this book shine are the drawings ! Never have i seen so many abstract concepts that are usually hard to grasp so intuitively depicted and explained as in this book !
Must read for anyone interested in DDD , functional programming , Fsharp and designing better and bug-free systems in general !
This entire review has been hidden because of spoilers.
Even without exposure to F#, the code examples are easy to follow. Trivially translatable to Scala, and even to Clojure with a bit of imagination. I constantly refer to this book on my day job (at a big fintech company).
I wish I had this book 5 years ago when functional paradigm and F# became part of what I do.
Even though we are all introduced to functional principles in school (without calling it functional, we just called it math) and later (I'm sure some even earlier) in Excel, it is not easy to isolate the afterwards acquired procedural and object oriented thinking. At that moment one has to reserve an innocent place in one's brain to fully embrace the functional paradigm without carrying the old habits along.
If I was reading this book then, with my mind as open as I now recommend to others, not only I would be impressed, I would be put on a good path right away. I would say that this book may be a good entry point to DDD as the context is practical and the F# type system is very fitting for the job.
Be aware that the content of this book may influence your take on thinking about systems, modelling, designing your applications and that may lead to some friction with other fellow developers that may lack the context you just gained.
The book deserves more in terms of formatting. E.g. pictures and tables should have titles, descriptions. The Pragmatic Programmers series suffers in that regard in general, but the contents compensated for that well enough.
This Book explains the thought process of Software Design using the Functional Paradigm very well. It's not about the language F#, it's about the paradigm. I do not use F#, nor am i'm planning to. Still, the book had a lot of value to me.
A key learning is how to take advantage of Types to achieve a better Domain Model. For me, a OO Guy digging into FP, it was a mind opener. It teached me how to think in workflows, how to compose and streamline testable functions, how to inject dependencies using partial application, and how to achieve a great result even without using a single monad.
Brilliant introduction to Domain-Driven Design, designing with types in F# and "railway-oriented programming".
If you have an interest in any or all of these topics, this book takes an entire feature, from discussing with business stakeholders over designing your code purely on a type level to implementing the actual business logic in a clear cohesive story. It even touches on async/error handling, something a lot of introductory material is very handwavey about and shows how to tackle these concerns in a more functional way.
Scott made a book by basically distilling, rewriting and ordering a lot of the material on his website. And he did good!
There is a fine introduction to DDD and a lot of neat tricks on how to do it in F#.
Downloading the accompanying code will probably make a dent in your admiration for Scott, though. Functional programmers are seemingly in general lazy people and consistently forget the WORM - Write Once, Read Many - aspect of programming.
I got a lot out of the first half of the book where the essence of ddd is distilled very cleanly from a functional point of view. I consider many of these viewpoints as close to canon as it gets in software development. Outstanding 5/5
The second half was a mix of strict functional programming strategies like making pure pipelines by composing meticulously typed function inputs and outputs to match each other (I am not a fan of this approach. While satisfying and beautiful, I find it difficult to read, write, and refactor in practice, with no clear benefit. Perhaps I will “see the light” some day :) ) and F# -specific implementation details like serializing Json. There were some gems here and there, but i found myself skimming. I should note that this may be due to me picking up a F# book as a non-F# programmer.
All in all, this is one of the more important books I have read about programming, and recommend just about everyone working on anything related to software to read the first half. Call it “DDD: The Good Parts”
This is a fantastic introduction to both DDD and Functional Programming in a very accessible book. Being grounded in a very concrete and coherent example it's really easy to relate to the ideas presented in the book. If there is anything I felt lacking from the book, it would be a little more examples of tests and driving implementation with tests alongside driving it with the type system.
Surely one of the best book how to implement the tactical part of DDD in a functional way. Totally practical, avoiding Category Theory, and giving a lot of knowledge about how tu use functional programming and types to implement a very robust domain.
I think it was clear, solid, and well thought out. I learned a model of organizing software architecture, using types as state machines, and allowing them to be driven from your domain and those types driving your computation.
This is an introductory book and does not cover more advanced functional programming topics, nor does it cover Domain-driven Design (DDD) in detail (see Eric Evans' Domain-Driven Design: Tackling Complexity in the Heart of Software and Vaughn Vernon's Implementing Domain-Driven Design), but it does a good job of explaining how functional programming is a great fit for DDD with clear use of examples.
The author does a good job of starting with simple but naive approaches to software design problems, then explaining the issues they are susceptible to. He follows these with better functional designs and explains the trade-offs. Throughout the book, he uses a coherent example with enough scope to demonstrate common software design problems, instead of jumping around different unrelated examples as other books sometimes do. This helps the reader to see how all the solutions fit together and how they affect one another, with each chapter refining the reader's understanding of the problems and the solutions.
More detailed information and advanced topics can be found at the author's website F# for Fun and Profit, so if you've already covered that, the material in this book presents a more structured approach to that material.
The book is a bit short and I would have liked for it to cover more of the material from the website with the same style and structure in the book with clear examples.
It is a good intro book on doing DDD functional way. To a degree, it's covering the same topic as "Functional and Reactive Domain Modeling" by Debasish Ghosh. But it's significantly shorter and with more evident emphasis on types driven development. While Ghosh's book is about "i learned about FP, now I want to understand how to write business applications in this style", this one is more about "I know how to do DDD, how can I do it in fp style? But please no category theory this time"
It's a short and easy read, because of limited scope (compared to "Functional and Reactive Domain Modeling") it actually drives points home and makes it clear and concise. No previous exposure to F# required. The knowledge of how to read F# will come up as a bonus after reading this one. Highly recommended.
This book is just great! It gives a great introduction to DDD and then moves on to show how you can do domain modeling with functional programming. Although the examples are in F#, the book focuses more on explaining and showing functional programming concepts you can use to tackle complexity. I can highly recommend this to anyone who is interested in doing functional programming in complex domains.
A solid introduction to functional programming, but not without flaws
In this book, Scott Wlaschin walks us through an imaginary software design project and demonstrates how we can apply functional programming paradigms, as well as the particular capabilities of the F# programming language, to tackling large application development through domain-driven design (DDD).
Some highlights of the book that felt particularly important to me:
* Wlaschin lays out the fundamentals of Domain-Driven Development, including:
- Domains: Areas of knowledge associate with a problem (e.g., "Billing", "Shipping", or "Intake") - Domain Model: Simplifications that represent a domain to stakeholders - The Ubiquitous Language: A set of concepts and vocabulary associated with the domain and shared by both team members and the source code - Bounded Context: A subsection in the solution space with clear boundaries from other subsystems. Subsystems have their own concepts and vocabulary - dialects of the Ubiquitous Language. - Events: Records of something that has happened in the system - Commands: A request for something to happen, triggered by a person or event.
* We learn about how events and commands can be used to connect different bounded contexts, allowing them to work together harmoniously while remaining fundamentally decoupled.
Key points here were that each of our bounded contexts need to be able to receive Data Transfer Objects (DTOs), picking up where other bounded contexts have left off. DTOs are received and pass through input and output gates, for validation/sanitization and serialization, respectively. Everything inside the bounded context can be trusted, everything outside must be treated with care - assume nothing, and we avoid much unnecessary coupling.
* Wlaschin introduces the idea of Onion Architecture
The basic concept here is that you keep your domain code stateless and pure, while positioning Async/IO processes (APIs, etc.) on the edges. How well this pattern holds up in practice is debatable, but it is a good ideal.
* We learn about a variety of functional programming patterns, and their application in F#
I won't go too deep here, but did learn a lot about a maximalist functional approach to building pipelines and adapting functions to be able interlink with other functions in the pipeline and pass on their errors as necessary.
I ultimately thought that pipelines are very cool when feasible, but was not convinced that some of the gymnastics that Wlaschin had us go through to achieve clean pipelines were necessarily worth it, or sufficiently maintainable to justify the overhead.
* Wlaschin argues - quite successfully - that types can largely replace documentation
One very powerful idea in this book, and demonstrated in F#, is that code can be demonstrably correct. Throughout the book, Wlaschin emphasizes patterns that make it literally impossible to introduce certain errors. Practiced with discipline, this style of coding could eliminate the need for some classes of tests.
Summing up:
I felt like the book got weaker as it went along, both because Wlaschin tried to accomplish too much in too short a book, often hand-waving advanced concepts, while perhaps spending too much time on trivial concepts and code examples.
I also felt like F# was both the strength and Achilles heel of this book. Because Wlaschin spent so much time evangelizing the special abilities of F#, it was at times hard to translate the techniques he demonstrated into other, less-functionally-oriented languages (like Javascript/Typescript, for example).
Overall, this was a solid book that I would recommend for folks who are interested in going deeper in the functional programming paradigm. And the Domain-Driven Development model was useful for understanding the thinking behind the Redux state management framework that is very popular for front-end applications.
Still, the book has some weaknesses of spotty depth and sort of peters out towards the end.
A well written and well thought out book where you can learn two things at once without feeling overwhelmed or either feeling watered down, although it leans a bit more towards FP than DDD. You won't become an expert in either but you'll definitely have a good theoretical grounding at the end.
The book uses a fictitious case study that, while being necessarily simple, is still complex and believable enough to serve its purpose. It also doesn't oversell DDD as a silver bullet/panacea which I appreciated - the rough edges and tradeoffs of the approach (especially when using an explicit FP language) are openly noted.
The only negative I have is that while most fundamental F# concepts and syntax are explained quite thoroughly in the first two thirds of the book, in the last third they're suddenly glossed over as if you've magically gone off and learned a whole bunch of things on your own. This is jarring and a bit annoying but overall a minor issue.
This book opened a new world of possibilities in the software development world. The author clearly knows what he writes about and explains it very clearly. I like the ordering: a general theoretical review but with a practical problem in mind, then focus on types, than focus on functions and actual execution. This resembles how a real-life project would be developed (in iterations, of course).
What I actually don't like are the implementation details. The author should make it more clear that a proper knowledge of the F# programming language is required, and should make the examples more self-contained. The code examples are larger than simple snippets that show some concepts, but are not complete and cannot be executed. There are also no examples of real input data. I began to type along the examples, but got frustrated when I saw that I could never test the code.
Nevertheless, this book taught me important concepts, like "function as a type" and validated my view that "every little concept should have its own named class/type/function".
This book teaches by an example. The author took an examplary project done with a functional programming approach and described three phrases from it (Analysis, Design, Implementation).
Part I - Analysis - Discovering Domain (general knowledge). For me, it is the best chapter of all. The author starts with the event storming session for discovering events, commands, and subdomains in problem space. After this, he creates a solution space with bounded contexts and relationships within them (context map).
Part II - Design - Designing the Domain Model (with F# types). It is a great introduction to functional thinking - the reason why I read this book.
Part III - Implementation - Implementing the Domain Model (with F#) It describes the most common implementation decisions in F# approaches (object persistence, error handling, managing dependencies, testing, etc.). If you are not planning to use functional programming, you can skim this part.
It's a good reading for people interested on learning about Domain Driven Design using real world business applications. Really well written book, its first two parts are extremely beginner friendly, but the last (and most important part) not as much. The last section of the book assumes you're already familiar with some of F# syntax and constructors, although, one can easily follow up the book until it's end without knowing it. Sometimes I felt like it missed showing up the entire view of the project and keeping the reader updated about it, and the Functional Error Handling and Pipeline with functions chapters could benefit from more space in the book, as some others previous chapters have. It's an amazing software development book, and a good guide for people who wants insights on how to create and maintaining a real world application using F#.
Good high level guide to DDD using the functional programming paradigm
The functional programming paradigm is an excellent match for Domain driven development and this book provides a helpful walkthrough of some of the specific techniques that can be applied to the practice. The opening chapters give a high level grounding in DDD concepts (Event storming, Bounded contexts, Ubiquitous language, etc.) and the following chapters take a deeper dive into implementing them using a functional approach. F# is the author's language of choice and we get to see how flexible it can be in modelling business domain requirements. Neither a thorough guide to DDD nor F# this book nevertheless plays an essential role in demonstrating the utility of the functional programming paradigm to DDD.
This book walks you through the key concepts of Domain Driven Design in a practical and easy to grok manner. Examples are well crafted and do not require expertise of F# (I read it with a little knowledge of a similar language, Kotlin). It helped me learn the "why" behind functional patterns.
The journey starts with identifying the Vocabulary for a Domain (ubiquitous language) using Event Storming. Next modeling with Types is covered. Workflows are represented with Functions along with the Types. Second part covers implementation strategies - dependency injection, handling effects with railway oriented programming and so on.
Really good book to get a clear view of what it is to start a project from scratch making use of Domain-Driven Design and functional programming. Even if you don't know anything about how F# works, the author of the book makes really easy to follow how all the design and development of a project in DDD with functional programming should be done in F#. Nevertheless, the programming language used in the book is not a constraint for the book being enjoyed and learned from. I would recommend this book to anyone who wants to start a new project using DDD or functional programming no matter what the language preferred to use.
Really fantastic book. It has made me completely change some fundamental ways I design software.
The book uses F# in the design implementations, a language that I have never used, though I have some years of functional programming experience. It isn't an intro to F# but either because of its simplicity or the author's incredible teaching ability, everything makes sense. You don't need any background in the language.
I really can't say enough good things about this book. Highly recommended.