News for hackers. Stuff that matters.
Re:Why Use Onion Layering? by orthoxerox on Wednesday July 10, 2024 @08:30AM (#40926173)
Yes and no. Onion is similar to IO-less Rust or "Functional core, imperative shell" in that it goes one step further from inversion of control/monadic effects and removes all control/effects from the inner layers.

You get some benefits like being able to write very straightforward business logic, but in return you:

- have to constantly fight the entropy, because every day you'll have to implement another corner case that is 2 points if you violate the layer isolation and 10 points if you reengineer the layers to preserve it

- have to constantly repeat yourself and create helpers, because your API layer objects, your domain layer objects, your DB layer objects all look very similar to each other.

Sometimes a transaction script (in Fowler's terminology) with basic DI scaffolding is easier both to write and maintain, especially when the domain isn't rocket science.

There are no comments on this comment yet.