# Domain Modeling Made Functional

## Workshop notes

![](https://1936518372-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAffO8xa1ZWmgZvfeK2%2F-MEXZOZVhFDoG_I5iVA6%2F-MEX_ECHmIxthxUqkbFy%2Fimage.png?alt=media\&token=3ff91aac-64db-458d-9c08-2b4a5c30d164)

![](https://1936518372-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAffO8xa1ZWmgZvfeK2%2F-MEXZOZVhFDoG_I5iVA6%2F-MEX_Nls3K03oJ-3NN-S%2Fimage.png?alt=media\&token=8d09c146-43f7-420b-96ec-1cfe86d96636)

![](https://1936518372-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAffO8xa1ZWmgZvfeK2%2F-MEXZOZVhFDoG_I5iVA6%2F-MEX_PWPiIvw3YqJI-0c%2Fimage.png?alt=media\&token=50080101-2ed0-4c2c-b949-6b7a63411728)

![](https://1936518372-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAffO8xa1ZWmgZvfeK2%2F-MEXZOZVhFDoG_I5iVA6%2F-MEX_d-TmROl4G76Agvn%2Fimage.png?alt=media\&token=d15dd971-fb24-4791-af44-28eecc8ccffc)

![](https://1936518372-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAffO8xa1ZWmgZvfeK2%2F-MEXZOZVhFDoG_I5iVA6%2F-MEX_iWLynMGwh_yzAA8%2Fimage.png?alt=media\&token=1887ef40-c144-4157-8ba1-4db205f283b0)

## Source code

<https://github.com/swlaschin/DmmfWorkshop>

## **Extra Material of the Workshop**

* [Four Candles](https://www.youtube.com/watch?v=CNTM9iM1eVw) -- comedy sketch with lessons for DDD
* [Reinventing the transaction script](https://www.youtube.com/watch?v=USSkidmaS6w) (talk)
* Functional DDD
  * [fsharpforfunandprofit.com/ddd](https://fsharpforfunandprofit.com/ddd/)
  * [“Designing with Types” series](https://fsharpforfunandprofit.com/series/designing-with-types.html) on fsharpforfunandprofit.com
  * [Serializing a rich domain model to a database, JSON, etc](https://fsharpforfunandprofit.com/posts/serializating-your-domain-model/)
  * [Code from "Domain Modeling Made Functional" book](https://github.com/swlaschin/DomainModelingMadeFunctional)
  * [Evolving a DDD design: Microwave example project](https://github.com/swlaschin/Microwave/tree/v1)
  * [Functional Domain Modeling (Scala Version)](https://www.slideshare.net/pjschwarz/scala-3-by-example-algebraic-data-types-for-domain-driven-design-part-1)
* Learning F#
  * [FSharpKoans](https://github.com/ChrisMarinos/FSharpKoans/tree/fsharp/FSharpKoans)
* F# Front end:
  * [Elmish -- the Elm Architecture for F# frontends](https://elmish.github.io/elmish/)
  * There is a whole (excellent) [book on using Elmish](https://zaid-ajaj.github.io/the-elmish-book/#/)
  * Also <https://compositional-it.com/blog/2017/09-21-safe-elmish/index.html>
* F# web frameworks:
  * <https://safe-stack.github.io/>
  * [Giraffe](https://github.com/giraffe-fsharp/Giraffe) (uses ASP.NET core)
  * [Suave](https://suave.io/) (standalone)
* Working with JSON and databases
  * [Serializing your domain model](https://fsharpforfunandprofit.com/posts/serializating-your-domain-model/) -- how to share algebraic data types with the outside world
* Advanced F#
  * <https://fsharpforfunandprofit.com/video/>
  * [Capability-based design](https://fsharpforfunandprofit.com/cap/) talk and blog post
  * [Map, apply, bind and “elevated” worlds](https://fsharpforfunandprofit.com/series/map-and-bind-and-apply-oh-my.html)
  * [Cyclic dependencies are evil](https://fsharpforfunandprofit.com/posts/cyclic-dependencies/)
* Event sourcing
  * [Event Sourcing - Step by step in F#](https://medium.com/@dzoukr/event-sourcing-step-by-step-in-f-be808aa0ca18)
  * FsUno - <https://github.com/thinkbeforecoding/FsUno>
  * [A more advanced version of FsUno](https://github.com/thinkbeforecoding/FsUno.Prod) closer to what would be put in production
* Adopting FP in your company
  * [Video: Adopting FP: A Human-First Approach](https://www.youtube.com/watch?v=vpcKnqyNdSQ) -- how to ensure that new ideas work inside a company
* F# tips and example code
  * [F# to C# interop tips](https://gist.github.com/swlaschin/2d3e75a2ff4a87112c19309c86e0dd41)
  * [C# LINQ -> F# equivalents](https://gist.github.com/swlaschin/9b0f11a5fccc73a8c11f7f7551ef19a9)
  * [“Effective F#” gist](https://gist.github.com/swlaschin/31d5a0a2c4478e82e3ed60d653c0206b) -- a lot of guidelines for developing in F#
  * [DTO validation example](https://gist.github.com/swlaschin/886db5a0f8617ce6baab8c260a36e1be)
  * [AsyncExample.fs](https://gist.github.com/swlaschin/4ffac1a64bbfeab383cc3f0e7b09f169) -- some examples of Async
  * [AsyncResult Workflow Template](https://gist.github.com/swlaschin/c153c0c68d894f6e9542fb2a2cfb746e) -- demonstrates async and result workflow
  * [Utility.fs](https://gist.github.com/swlaschin/4e4d1b3323d120983299d21c6203e2dc) -- common classes like NonEmptyList, etc
  * [Testutils.fs](https://gist.github.com/swlaschin/6cc747dccdf678d192d816d1820b63ac) -- utilities for testing
  * [Wrapping](https://gist.github.com/thelegendofando/0a80060f4ac9a45819d8c3fcd066962c)(simple) -- AWS + Json wrappers

## To go further

Links for if you want to keep going after the workshop :

1. see the link at the bottom of the Google Docs file at
2. For C# compatibility, see code at: DmmfWorkshop/CSharpInterop
3. For monads and more, see slides: F-FP\_toolkit.pdf code: ***DmmfWorkshop/src/F-ImplementingWorkflows/01-Exercises.txt***
4. For capability-based design see: <https://fsharpforfunandprofit.com/cap/> <https://www.youtube.com/watch?v=fi1FsDW1QeY>

![](https://1936518372-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MAffO8xa1ZWmgZvfeK2%2F-MEXfxHrvj_wTEA82vPV%2F-MEXg-MU5-MBdT8uUV_s%2Fimage.png?alt=media\&token=f6b16eaa-003d-43c5-89bd-a08d7a376fb3)

{% hint style="info" %}
Read his great book on the topic : [Domain Modeling Made Functional](https://www.amazon.com/Domain-Modeling-Made-Functional-Domain-Driven/dp/1680502549)
{% endhint %}
