DEV Community

Cover image for Functional domain model

Functional domain model

Jakub Zalas on October 13, 2023

A functional domain model is made of pure functions and immutable types. As Domain Driven Design teaches us, it should be expressed in the language...
Collapse
 
mateusznowak profile image
Mateusz Nowak

Nice explanation :)
How did you draw those diagrams?

Collapse
 
jakub_zalas profile image
Jakub Zalas

Thanks! I have no drawing skills. Anything that comes out of excalidraw.com looks good.

Collapse
 
marciocg profile image
Márcio Conceịç̣̣ão Goulart

Nice article, well written and citing sources that enriched the content. Thanks for sharing!

Collapse
 
jakub_zalas profile image
Jakub Zalas

Thank you for taking time to comment!

Collapse
 
cherif_b profile image
Cherif Bouchelaghem

Thank you for the article.
Do you think is useful that the domain defines the services (use cases) contracts?
The implementation would compose pure and impure code like DB queries or emailing effects.

Collapse
 
jakub_zalas profile image
Jakub Zalas

No, I didn't find it useful on my last project. The contract is usually defined on the consumer side.

However, in the past, I'd do that with repository interfaces. I don't have them anymore (they're replaced with function types for queries).

Collapse
 
katafrakt profile image
Paweł Świątkowski

A functional domain model is made of pure functions and immutable types.

Great definition. I think I'm going to try to bring it into Elixir world.

Collapse
 
jakub_zalas profile image
Jakub Zalas

Thank you. You have no idea how many times I have rephrased it to simplify!