I recently started reading through Scott Wlaschin’s Domain Modeling Made Functional, in which Wlaschin pulls together F♯ and domain-driven design to teach both functional programming and DDD. As I’ve noted elsewhere in the past, very little of the book is truly specific to F♯, though that’s the language Wlaschin uses in the book—and Wlaschin himself agrees:
Thanks! Yes, it’s true that you could easily use #ElmLang, #RustLang, #Scala, or especially #OCaml to work through the book. I use hardly any F# specific features.
So… I decided to try something a little bit bonkers. I’m going to implement these exercises in four different languages:
These languages are all related: they’re descended from Standard ML. ReasonML and F♯ are like siblings: Reason is merely a custom syntax for OCaml; F♯ is (originally) an implementation of OCaml on .NET (though the two languages have diverged since F♯ came into existence). Elm and Rust are cousins of each other and of Reason and F♯, though they’re both drawing on other languages besides OCaml as well. I also have some familiarity with Rust, Elm, and F♯ already, and have read the docs for Reason a couple times. So this is a bit less crazy than it might otherwise be.
Why, though? Mostly because I think it’s be interesting to compare the implementations of the domain model from the book side by side. It’ll look just a bit different in each language, and I expect to learn a bit more of the feel of each language by doing this. (That side by side comparison is something I’ve done before and found very profitable.) I’ll also turn it into blog posts, which hopefully will be interesting to others!
Parts in the Series
This list is updated whenever I publish a new post in the series. You can also subscribe to the dedicated #four-languages RSS feed, or to the more general #rust, #elm, #fsharp, #reasonml, #domain-driven-design, or #domain-driven-design RSS feeds.
- Exploring 4 Languages—intro to the series, much the same content as this post)
- Project Setup—Getting Rust, Elm, F♯, and ReasonML installed; their editor plugins configured; and their project files ready.
- Starting to Model the Domain—How we use types to capture business concepts in Rust, Elm, F♯, and ReasonML.
- Integrity and Consistency—Making, and keeping, promises – with Rust, Elm, F♯, and ReasonML.