3 ms·
Here is an example that I'm quite partial to: Presentation - https://www.infoq.com/presentations/DDD-Clojure/ https://www.infoq.com/presentations/DDD-Clojure/
by adamkl 5y ago
Here is an example that I'm quite partial to:
Presentation - https://www.infoq.com/presentations/DDD-Clojure/ https://www.infoq.com/presentations/DDD-Clojure/
Code - https://github.com/zololabs/zolodeck https://github.com/zololabs/zolodeck
Its a Domain-Driven/Hexagonal Architecture codebase written in Clojure. Its not uncommon to see this sort of approach in Java/C# so it makes comparisons of the code relatively easy.
While the overall code layout is the same as what you'd see in Java/C#, a big distinction is that the "entities" that make up the core functionality of the domain in the Clojure version are simple data structures (rather than classes), and the logic that operates on them are pure functions (rather than methods on the classes themselves).
With this approach, a lot of the hoops you'd usually jump through with dependency injection to enable testability go away, since its easy to test pure functions that operate on simple data structures, no mocking required.
This sort of approach isn't limited to Clojure [0], but Clojure makes it idiomatic.
[0] - https://www.destroyallsoftware.com/talks/boundaries https://www.destroyallsoftware.com/talks/boundaries