Clean Architecture isn’t the problem. Misreading the book is.
Posted by niccololepri@reddit | programming | View on Reddit | 55 comments
I think Clean Architecture is mostly misunderstood.
In my current project (a huge mess of services for public administration), the only real source of truth for business rules is the code itself. The domain is defined vaguely by too many people, so new features often end up conflicting with existing rules—not because of implementation bugs, but because the rules themselves clash. But all of this is expected i guess.
The real pain: the architecture makes business rules unreadable. Adding a new entity state? No way to know if it breaks something without re-reading tons of code. Automated tests? They’re all full-blown integration tests, take 8 hours to run, so we usually just run a subset and pray.
This is exactly where Clean Architecture could shine—but I’ve never seen it done right. Most “implementations” I see (in my case in .NET) are just baroque, over-engineered garbage. People throw design patterns everywhere, abuse async/await, don’t even bother with interfaces, and then blame Clean Architecture for being unreadable. No—you just didn’t get the point.
The actual point is simple: use polymorphism to isolate business rules. Each rule implements an interface, so you can swap in fakes for tests. Result?
- Change one line → break one unit test (plus the relevant use case integration tests).
- Add new behavior → just add a new object and wire it up.
- Tests run in seconds/minutes, not hours.
Clean Architecture isn’t universal. If you’re writing 3D graphics, every abstraction may be just overhead. But if you’re drowning in business rules, it’s the only way to avoid shipping landmines straight to production.
So yeah, people ranting against Clean Code/Architecture in “Casey Muratori wannabe” mode don’t look clever. They just show they’ve never actually seen the point.
TL;DR: Clean Architecture isn’t about baroque boilerplate. It’s about isolating business rules so you can test them fast and safely. If your system is rule-heavy, it’s a lifesaver. If not, sure, skip it.
grauenwolf@reddit
Robert Martin, the author of that book, had never implemented a system using the concepts in that book. Not even for the purpose of a demo.
Think about that. You're trusting the advice of someone who hasn't even tried to do the thing he's telling you to do.
That's the fundemental misunderstanding of the book. It's not computer engineering, it's fiction.
niccololepri@reddit (OP)
Source?
grauenwolf@reddit
Prove to me that he never captured a unicorn.
If you have reason to believe that Robert Martin has actually implemented Clean Architecture , then all you have to do is show it to us.
niccololepri@reddit (OP)
It seemed that you knew for a fact that he never did implement it. Isolating business rules with interfaces and writing a solid test suite is no unicorn BS. I've made little project doing that by myself, its not that difficult. The problem is that the culture is like this: you read Clean architecture you see garbage abstractions. And this is not fair to the book
grauenwolf@reddit
I know for a fact that I looked around and found no examples of it. I know for a fact that I've talked to others who like why say they've never seen any examples of it. And I know for a fact that the code Robert Martin does offer on his repository is garbage.
niccololepri@reddit (OP)
It doesnt seem that you are interested in searching if you are wrong or not. Im not that interested either. I can understand a concept this easy without looking for an implementation. Its not rocket science
grauenwolf@reddit
P.S. I spent quite a bit of time looking for an example from Robert Martin so I could mock it. It's a lot easier to demonstrate that he's a charlatan when one has actual examples.
niccololepri@reddit (OP)
Its not my interest to demonstrate anything. You are. Im talking about a concept i think i understand
grauenwolf@reddit
What an idiotic thing to say.
You've already said that you've never seen a good implementation of Clean Architecture. From that alone I can infer that either you've never seen an implementation of Clean Architecture from Robert Martin or you have seen one and thought it wasn't good.
Could you explain to me why you are spending so much time defending this book despite the fact that you've never seen it result in a positive outcome?
niccololepri@reddit (OP)
Dont get too upset. The concept is simple: you isolate domain, application and infrastructure. You test the resulting objects mocking the behaviour of the ones that each tested object depends on. You end up with faster test and composable code. You can try with a very simple library. Its more difficult with bigger projects, because each person has to conform to the standard. And not only it is expensive, its not agreed upon people who misread the book. As you have demonstrated
mascotbeaver104@reddit
Can you provide an actually good example or system written by Robert Martin? OP is right, every example I have ever seen Bob Martin give is both A: a small demo made for demonstration, and B: despite bring A still abjectly terrible. You're demanding proof of a negative
mascotbeaver104@reddit
If you've never seen it implemented well, then perhaps there is a reason.
The thing you are missing is that how to isolate things in enterprise systems is often based on nebulous business boundaries that could change at any minute. The main criticism of clean architecture I see is that you have to build the walls of the building before you even know what the building is for, and that seems to be basically exactly in line with your experience.
niccololepri@reddit (OP)
That’s exactly my point: the business boundaries are nebulous, so the code ends up being the only source of truth.
But when the architecture doesn’t let you isolate rules, every tiny change becomes Russian roulette. Clean Architecture (done right) isn’t about “building the walls before you know the house”, it’s about making sure that when the walls inevitably move, you can shift them without collapsing the whole structure.
The implementations I usually see fail because they’re just pattern soup. Interfaces and polymorphism aren’t there as “extra walls,” they’re there to make rules testable and decoupled from the chaos of the domain.
Without that, you’re not adapting to business changes, you’re just shipping bugs faster.
chicksOut@reddit
Design for scalability. Sure, it might be a little extra work to add an interface for that first use case, but each use case after pays dividends.
grauenwolf@reddit
Adding interfaces and designing for scalability have nothing to do with each other. Interfaces address very specific problems, and none of those problems are "I need more hardware".
chicksOut@reddit
Scalability covers more than just increases in hardware. In OOP interfaces solve how does this object form a contract with the objects that utilize the original object. Different interfaces can allow the same base functionality while providing various flavors of interaction, which lends itself really well for scalable architecture.
grauenwolf@reddit
LOL. I love how you have that one throw away sentence about scalability and then proceed to talk about stuff that has absolutely nothing to do with scalability.
I learned a new term recently, "lie by inference". It's when you don't tell and explicit lie, but you structure you sentences in a way that leads the listener to think that you said something that would be a lie.
For example,
Into the discussion about AI capabilities, the lie by inference is trying to convince people that the reason for the layoffs are the AI investment even though there's no reason to believe they're actually associated with each other.
You're doing the same thing by mentioning scalability and then having the discussion about interfaces even though the two topics are unrelated. You want me to infer that scalability has something to do with interfaces, but I'm not going to fall for it because I know better.
chicksOut@reddit
You sound like a stable, educated individual. Enjoy your perception of reality.
grauenwolf@reddit
Another common tactic of deception. Rather than trying to show why I'm misunderstanding you, you switch to insults. The goal here is to change the topic of conversation away from the fact that scability has nothing to do with interfaces.
chicksOut@reddit
This is the internet, I have no idea if you're acting in good faith or trolling. You are either being purposely obtuse or lack an understanding of the dynamics of scalable design patterns. In one case, im wasting my time. In the other, there is a lot of groundwork to give you the fundamentals, and for what? You've shown yourself to be obstinate and fallacious, I doubt my efforts would be rewarded with gratitude.
grauenwolf@reddit
If you think empty phrases like "dynamics of scalable design patterns" would impress me then you're mistaken.
Are you capable of actually demonstrating how interfaces affect scalability?
chicksOut@reddit
Im apathetic to your impressionability. I already described the gist of it, feel free to explore some self learning. I no longer care whether you grasp the concept.
chucker23n@reddit
No, the code is the only source of truth because you didn't budget for documentation.
Mysterious-Rent7233@reddit
The code is the source of truth because if it isn't then you have two different sources of truth and it will almost never be clear which of them is the real thing. Unless you use Formal Methods for your documentation, which only maybe NASA and device manufacturers do.
niccololepri@reddit (OP)
I know, that's a problem i cannot solve.
chucker23n@reddit
Yeah, but clean architecture isn't gonna change that. Sure, if you do significant changes to the code, you'll understand "how is this implemented" more quickly, but
The real thing you need to fix there is to separate specification (what the client wants) and implementation (how you've solved it).
niccololepri@reddit (OP)
No, the problem we have is the test suite, wich we cannot run whenever we want
mascotbeaver104@reddit
Ya know I can't really engage with you without looking at specific examples, but I would say usually decisions that seem strange to a newcomer were made for reasons that may not be obvious. Even assuming you are completely correct, a pattern which is in practice never implemented well but is in theory great is no better than a practice that is in theory terrible.
chucker23n@reddit
This.
Onheiron@reddit
Some questions:
grauenwolf@reddit
Testing interfaces is risk free. So there's no chance that you'll find a bug that you'll have to fix.
Testing interfaces can be surprisingly verbose, allowing you to quickly increase the number of lines you've written in the week.
You get to experiment with all kinds of fun mocking libraries.
Since the tests don't do any real calculations or database access they run really fast.
Onheiron@reddit
Wait you're talking about mocking libraries, and that's fine, you pass mocked delegates to your business logic, but when you write a test, the SUT is a specific class, right? That's kinda all the point of TDD.
Also
I am not sure this is something I want tho.
grauenwolf@reddit
That's because you're a professional.
Beck, the 'inventor' of TDD, would probably tell you to think more about functionality than specific classes and methods.
Blogger TDD, on the other hand, loves the micro tests that Beck tells us to delete.
Onheiron@reddit
Well the test itself is what defines functionality, but then you gotta pass implementations through it. If you make 10 impl. of a single interface you still gotta test each single one. Beside, why are you having 10 different impl. of a business logic to start with? If they fulfill the same test logic what's the difference between them? And if your answer is "efficiency" or like "different persistences" that is not business logic and I doubt you should be really testing it unless you like testing other people's libraries.
grauenwolf@reddit
Not with a good mocking framework. Just tell the mock what the expected outcome is and you're good to go.
Well I do because I'm a firm believer in the Liskov substitution principle.
But it's so tedious to make sure that all 10 variants work. We should go the Extreme Clean Architecture route and have zero implementations. Don't worry, the tests will still fast.
TankAway7756@reddit
You're missing some sarcasm I feel.
niccololepri@reddit (OP)
1) The need of a solid test suite. If you isolate the business rules and you are probably at a good point. 2) No it's not a double inversion: infrastructure -> automation domain -> business domain. You are inverting all of dependencies one way. 3) you should always test implementations. But with interfaces, you mock the implementations that your object depends on, so you end up with only the test you need for the current object, which means your tests are not fragile
Euphoricus@reddit
To me, the main goal of Clean Architecture is to separate the business rules from infrastructure, to achieve reliable testability.
Is perfect indicator you do not have Clean Architecture.
The most common issue is database. Your code should be structured such that the automated tests can verify meaningful business rules, without having to spin up full database.
This to me is really easy goal to understand and demonstrate. Yet most developers seem to be unwilling to design their code to achieve this goal.
niccololepri@reddit (OP)
Yeah, exactly, get the claims of the book precisely because I’m stuck in the “8-hour integration tests” hell. That’s the pain Clean Architecture is supposed to prevent.
grauenwolf@reddit
Why are your tests taking so long?
Are you using anti-patterns such as rebuilding the database for each individual test
Are there performance issues in the code that need to be addressed?
Integration tests need to be done regardless of which architecture you choose.
niccololepri@reddit (OP)
No it's just that we are testing a good part (but not every) of the logic branches of about 8000 web api call, all of them havig sub calls to other services (microservices made very wrong)
grauenwolf@reddit
Sounds like the tests are working perfectly. They're telling you that your microservice architecture is wrong and is going to have performance problems. So the solution is the start combining services until you get to the point where performance is reasonable again.
niccololepri@reddit (OP)
No performance is not an issue, the issue is running and maintaining all the tests. Which requires a better architecture. I had my fun trying to convince people. Now i just rant and try to tell my story
grauenwolf@reddit
If it takes you 8 hours to run non-stress tests, that's a performance problem.
niccololepri@reddit (OP)
1 simple web api call takes us 250 ms to run. We are ok with that
grauenwolf@reddit
No, the goal of Clean Architecture is to sell books and speaking engagements. When you try to use it and inevitably fail, the hope is that you blame yourself and spend more on training.
Literally no one who teaches Clean Architecture has successfully implemented Clean Architecture. Many, like Robert Martin himself, haven't even tried.
gjosifov@reddit
there is a implementation of Clean Architecture that works it is Jakarta EE - if you read the architecture and what it is trying to achieve it is 90% Clean Architecture and it works great
10% isn't clean because you have to pollute your classes with metadata a.k.a annotations
Rich-Engineer2670@reddit
I would also suggest the "Clean" movement has become a religion. No one objects to well-written, readable, maintainable code --p we've all seen the opposite, but sometimes, people take these guides and mandates and we end up with things like "No function should be more than 30 lines" or "Variables must be written in CamelCase." I remember one compiler that would not compile procedures more than one screenful of code.
These are guides, but all "rules" have exceptions -- it's up to you to know when to accept and break the rules.
niccololepri@reddit (OP)
I get that and i agree to a certain degree. But i see people criticising all clean architecture without getting the main point. Well written TESTS
Rich-Engineer2670@reddit
There we agree -- most modern languages have ways to test your code as you go -- I guess, until you create the giant bug-ball and have to clean it all up and once, you don't know why testing is a priority,
larikang@reddit
From the Clean Architecture book:
The trouble is almost entirely in deciding which parts of the architecture will actually be worth the effort for your application and where those architectural barriers should be placed. IMO Uncle Bob does a very poor job of emphasizing this tradeoff and helping you figure out the particulars for your use-case.
Are most critics of Clean Architecture misusing it? Probably. Did Uncle Bob (accidentally) encourage that misuse? Probably.
niccololepri@reddit (OP)
Yeah, I agree. But to me, the misunderstanding happens when people skip the main benefit altogether: a test suite that’s comprehensive and resilient. That’s the main point that i took from the book. Without that, you just end up with boilerplate code and still no safety net.
chucker23n@reddit
No, it's just very vague, and might as well be named "write good code". It's like doing an election campaign with the slogan "less government waste!". Yeehaw! We all want that.
OK, but how do you actually achieve it? Have you analyzed what's bad about the existing code? Does the entire team agree with that analysis?
Not very uncommon for enterprise software. This is also not a problem an architectural pattern is going to solve, because it's not a technical problem, but a social one:
Without more context on why things ended up that way, it's hard to judge.
It's great to say "oh, there should be more tests" and "oh, the architecture isn't great", but if your higher-ups don't give you time to actually make that realistic, it's not going to happen.
This sounds like 1990s' "use inheritance everywhere; what could go wrong?" hell, tbh. It doesn't make your architecture cleaner; it just makes it much harder to comprehend.
Sure, that sounds great on paper. But do you really want to turn "if an invoice is sent by person X, and goes to country Y, has currency Z, and the creditor is tardy with payments, always CC Jenny" into
public InvoiceWrittenByPersonXForCountryYWithCurrencyZAndTardyClient : IBusinessRule
? I personally wouldn't.IME, unit tests are excellent for things like parsers, but they break down when you have a complex piece of enterprise software. You also often end up with the "all tests look good, and yet the actual user-facing use case doesn't work" scenario.
niccololepri@reddit (OP)
I get your point, but in our case the real issue isn’t about choosing the right abstraction, it’s the lack of willingness to invest in a test suite that’s both comprehensive and not fragile. And i think that claiming that CA is not worth it is not going to help.
The core message of the book is to isolate business rules so you can build reliable tests around them.
dr1fter@reddit
Thanks ChatGPT, very cool, I'm sure Clean Architecture appreciates your efforts.