3 ms·
I asked this question, because I do have doubts they exist. Especially, any modern one. These architectures were introduced around 20 years ago to address tec
by orangehacker 4y ago
I asked this question, because I do have doubts they exist.
Especially, any modern one.
These architectures were introduced around 20 years ago to address technical shortcomings of enterprise systems at that time.
Quoting the original article on Hexagonal architecture (https://web.archive.org/web/20090327032122/http://alistair.cockburn.us/Hexagonal+architecture https://web.archive.org/web/20090327032122/http://alistair.c...), the motivation was to address those 3 problems:
> - First, the system can’t neatly be tested with automated test suites because part of the logic needing to be tested is dependent on oft-changing visual details such as field size and button placement;
> - For the exact same reason, it becomes impossible to shift from a human-driven use of the system to a batch-run system;
> - For still the same reason, it becomes difficult or impossible to allow the program to be driven by another program when that becomes attractive.
Is any of the above a real pain in the project that you are building in 2022?
I very much doubt it is. And if it's not, then introducing such an architecture will bring more harm than benefit.
There were some interesting discussions on that topic lead by Martin Fowler few years ago: https://www.martinfowler.com/articles/badri-hexagonal/ https://www.martinfowler.com/articles/badri-hexagonal/
- UK-Al05 4y agoTo this day automated tests suits against UI tends to be flaky. So testing against a code api is indeed better. Most of this stuff is just developing against interfaces, and having that interface owned by the business code. All infrastructure code implements those interfaces. Business code code doesn't get polluted by technical infrastructure stuff. It's easy swap out databases, etc Always a good idea. Functional core, imperative shell is also a modern term for this.
- orangehacker2 4y ago> To this day automated tests suits against UI tends to be flaky. So testing against a code api is indeed better. You don't need hexagonal architecture to test the code api. Layered architecture will do the job!
- UK-Al05 4y agoThe only difference between layered and hexagonal is dependency direction.
- simplotek 4y ago> I asked this question, because I do have doubts they exist. Especially, any modern one. It sounds like you don't do much, if any, professional work. > These architectures were introduced around 20 years ago to address technical shortcomings of enterprise systems at that time. No, not really, and your personal assertion completely misses the whole point of DDD or any software architectural style you mentioned. The whole point is to keep software flexible and accommodating of change, and in the process reflect a set of very basic software design principles that avoid/eliminate problems such as circular dependencies or testability. > Is any of the above a real pain in the project that you are building in 2022? Again, you don't seem to have much if any professional experience. UI testing, or any type of testing involving UI work either directly or indirectly such as accessibility/localization or any end-to-end test in general, is still an unsolved problem and a bane of software engineers. Nevertheless, your comment reads like a strawman. The main benefit, and the whole point, of layered architectures is to ensure the software architecture to simplify modifying/updating the bits that change very frequently and stabilize and minimize the need the fundamental bits that only rarely need to be touched. UIs tend to be the part of an application that is updated the most, thus it makes all the sense in the world to adopt a software architecture which handles UI as a separate external component which minimizes or eliminates both fan-in, and turns fan-out to be a non-issue by depending on abstract interfaces whose concrete implementations are injected. These are not dad's from the 1990s,these are fundamental software engineering concerns.
- orangehacker2 4y ago> misses the whole point of DDD or any software architectural style you mentioned. I didn't mention DDD. > a set of very basic software design principles that avoid/eliminate problems such as circular dependencies or testability. You don't need hexagonal architecture to achieve that. How is hexagonal architecture superior for building modern web applications vs for example vanilla Rails? Why successful projects like discourse, hacker news are not built following this architecture? Why you never hear stories of how hexagonal architecture helps companies like Google, Facebook, Microsoft, or Apple build great software?
- orangehacker2 4y agoAlright, I think I have found the main point of our misunderstanding: > The main benefit, and the whole point, of layered architectures is to ensure the software architecture to simplify modifying/updating the bits that change very frequently and stabilize and minimize the need the fundamental bits that only rarely need to be touched. The thing is - "onion/hexagonal/clean" architectures and "layered architecture" are not the same things. Of course layers are fundamental - nobody questions them. What I do question, are 3 mentioned architectures. For example MVC is also a layered architecture, and in many cases it works great. It allows the same level of testability as hexagonal architecture, but with less boilerplate and indirection. It is great for building websites like this forum.
- falkensmaz3 4y agoAll of these things are very much real problems. You just have to be building microservices in a corporation that's still running thousands of batch jobs on mainframes and midrange servers. It's super fun let me tell you.