Ever since I learned about Domain Driven Design from Scott Wlaschin, as he applies it to Type driven design in ML languages (specifically F#), and about Type narrowing from Richard Feldman in his talk, Scaling Elm Apps, I’ve wanted to learn more about combining these two approaches to form a first class discipline to develop apps in Elm.
Unfortunately Richard’s talk only introduces type narrowing and briefly explores the potential for Extensible Records to make Type narrowing viable - and strangely the Elm community hasn’t done much to develop this beyond what is presented in the talk.
Domain Driven Design is typically seen as a highly prescriptive structural discipline that is only used at scale and then only in the context of Micro-services.
Yet, Scott Wlaschin makes a compelling case for applying the essence of DDD at a significantly smaller scale and, it seems to me, ideal for use in the frontend (particularly applicable to Elm’s SPA remote data and Type focus).
But even here Scott only introduces DDD and it hasn’t been picked up by the Elm community.
So, for those of us that want to reason about Elm code using these two very complementary approaches there just hasn’t been anything to dive into.
I’ve read a few posts and articles that touch on one or the other but nothing comprehensive and nothing combining the two. On the topic of narrowing Types there isn’t a consensus on the use of Extensible Records as an excellent way to facilitate access. Generally the discussions present conflicting opinions and participants tend to loose sight of what it is that Richard sees as being valuable in their use.
It is highly frustrating that Type narrowing remains an outlier in Elm and that it was never understood or explored, beyond its use to simplify scaling, as a companion to any form of Domain Driven Design.