![]() ![]() Attempting again to learn Domain Driven Design, and it's clear if you're an Object Oriented Programmer trying to learn Functional Programming, no wonder you're confused.Terramodel TML List (including commands) compiled by Geocomp Systems TML List of Terramodel commands available from Geocomp Systems The TML List Here's a paragraph summary of the 500 page book I've translated each sentence into typed FP. OOP: You model your business using Entities (the ID matters) and Value Objects (the values matter).įP: You model your business using Types, Aliases, and Unions. OOP: You use Repositories to retrieve and store them.įP: You use functions to retrieve them.Įverything is immutable so has an implied ID, but you can add if you wish. You can't store them as there is no state. OOP: You create them with the help of Factories. OOP: If an object is too complex for a single class, you’ll create Aggregates that will bind Entities & Value Objects under the same root.įP: There are no classes, only functions that return immutable Types and Unions. Complexity just grows into more functions. OOP: If a business logic doesn’t belong to a given object, you’ll define Services that will manipulate the involved elements.įP: Objects don't have state or methods you just create new functions return that return new values. OOP: Eventually, when the state of the business changes (a change that matters to business experts), you’ll publish Domain Events to communicate the change.įP: A function will get an input and return a value.Ĭaveat with the above is F# and Scala _do_ have classes and you can map your mental model of DDD around the boundaries. However, if you're doing Event Sourcing or CQRS, hopefully you can see how your life just got a lot simpler. (OOP people are thinking "dangerous")Īlso, while "there is no state" in FP, there is always _someone_ who stores your state. ![]() The Database on the back-end, the Step Function in your infrastructure, the " Model" in Elm front-ends.Ī lot of what I'm learning from researching DDD is the same thing the Agile crew uses Behavior Driven Design: learning the Business language, and modeling it into your code. Understanding the different types of users, the words they use, and making that strong types. But if you remove stateful objects, then you're just left with functions. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |