Clean Code Without Dogma: What Actually Matters
Clean Code became a religion. Here's which principles have real ROI, which are cargo-culted rules, and how to push back on dogmatic code reviews.
You're in a code review and someone rejects your PR because a function is over twenty lines long. Not because it's too complex, not because it's hard to test — just because it's over twenty lines. The rule got memorized, the context got ignored, and now you'll spend the afternoon splitting a perfectly readable function into three incoherent pieces.
So, is Clean Code worth it? Yes, as a set of principles: honest names, separated responsibilities, tests that document behavior. No, as a numeric checklist applied without asking what problem the rule solves. The difference between those two readings is what separates code that's easier to maintain from code that's merely more fragmented.
This post separates what in the book reduces bugs and maintenance cost from what has become dogma. Its sibling, about the same habit applied to object-oriented design, is SOLID principles: when they help and when they become dogma.
What Clean Code is — and what changed in the 2nd edition
"Clean Code" is Robert C. Martin's (Uncle Bob's) 2008 book, and by extension the idea that code is read far more often than it's written, so it should be optimized for reading. The original book used almost exclusively Java examples and very concrete rules: small functions (hardly ever over 20 lines), few arguments (ideally none, more than three only with special justification), comments seen as a failure to express yourself in code.
A 2nd edition came out in 2025 from Addison-Wesley/Pearson (the publisher's page lists September 30, 2025). The publisher itself calls it a comprehensive rewrite, and the changes matter to anyone asking "should I read it?":
- Examples in Java, JavaScript, Go, Python, Clojure, C# and C — no longer just 2008 Java.
- It folds in SOLID, component principles, and a whole part on architecture (material that used to live in Clean Architecture).
- New chapters on testing disciplines (TDD, acceptance testing), on AI, LLMs and "programming by prompt", and a part on craftsmanship and ethics.
- An appendix on the debate around Clean Code itself.
That debate is real and public. Between September 2024 and February 2025, Martin and John Ousterhout (author of A Philosophy of Software Design) argued in writing about method length, comments and TDD. Ousterhout argues that over-decomposition produces shallow, entangled methods you can only understand by reading them all together; Martin would rather err on the side of decomposing. On comments, they never found common ground. Reading both sides is worth more than any summary — including this one.
Why Clean Code turned into dogma
The problem isn't the book. It's that the rules got detached from their context and became linter config and PR standards.
"Functions should do one thing." True — but what's "one thing"? It depends on the level of abstraction. A process_payment function that validates the card, debits the account and sends the confirmation email can be doing "one thing" — processing a payment — if each step is a well-named call.
"Functions should be at most X lines." Arbitrary number. A fifty-line function that's a sequence of well-named validations is more readable than five ten-line functions you have to keep jumping between to follow the flow. That's exactly Ousterhout's point.
"No comments — code should document itself." This is the most dangerous one. Self-explanatory code is a legitimate goal, but there's knowledge code can't express: business decisions, deliberate tradeoffs, regulatory constraints. "We use MD5 here because the acquirer's legacy system doesn't support SHA-256 yet" is a comment that saves hours of investigation. Deleting it in the name of clean code is sabotage.
The Clean Code rules, one by one
| Rule | Verdict | Why |
|---|---|---|
| Intention-revealing names | Always worth it | Highest return at the lowest cost; a lying name is a bug waiting to happen |
| Small functions / "do one thing" | Depends | Good as pressure against god functions; bad as a line limit |
| At most 3 arguments | Depends | Many arguments signal a missing concept; sometimes the answer is an object, sometimes not |
| Avoid comments | Ignore as a rule | Comment the why; don't comment the what |
| DRY | Depends | Duplicating twice is cheaper than abstracting wrong |
| Clean tests, one concept per test | Worth it | A well-named test is an executable specification |
| Error handling separate from logic | Worth it | Makes both the happy path and the failure path easier to read |
| Consistent formatting | Worth it, but delegate | That's a formatter's job, not a code reviewer's |
What actually reduces bugs and maintenance cost
When you look at what causes production incidents and maintenance pain over the years, the patterns that show up are different — and almost none of them are about function length.
Names that lie. A data variable that holds a user, a get_user function that also writes to the database. Honest naming is the best-value principle in the book. It's not about long or short names: it's about names that match what the thing does.
Shared state without discipline. Mutable state scattered across the system makes code impossible to reason about. A small function that touches global state is far more dangerous than a large one that only operates on local data.
Implicit coupling. Two parts of the system that depend on each other without that being written down anywhere — a magic constant, a convention that only lives in the author's head, a hidden side effect. That's what makes a simple change break three unexpected places.
Missing invariants. Code that allows impossible states: an Order with no items, a User with a null email months after go-live. Using the type system and database constraints to make invalid states unrepresentable is one of the cheapest investments in quality.
Tests as specification. Not the 80% coverage target, but a test that documents expected behavior with a name that reads like a sentence. What's worth testing and what's waste is in unit testing: what to test and what to skip.
When the rule hurts more than it helps
Performance-critical code. In 2023, Casey Muratori published Clean Code, Horrible Performance: he took the classic polymorphism example for computing shape areas and showed that replacing the class hierarchy with a switch gave 1.5x, and a table-driven version reached roughly 10x to 15x depending on the calculation. It's a microbenchmark and many people pushed back on generalizing it, but the point holds: on a hot path, the "clean" version can cost an order of magnitude. Document why the fast version exists and don't refactor it to look clean.
Glue code and migration scripts. Code that runs once and gets deleted doesn't need the guarantees of code that will be maintained for years. Two hours extracting helpers in a script that runs tomorrow and goes in the bin is waste.
Prototypes. When you're validating a product hypothesis, the code that matters is the code that lets you iterate fast. The mistake is keeping that pattern after the experiment becomes a feature — that's when the investment pays off.
Too much architecture. The same dogmatism shows up at a larger scale: layers and interfaces for a CRUD that will never change databases. The costs and when it pays off are in Clean Architecture: real benefits and common pitfalls.
How to answer a code review that only cites rules
If your team applies rules mechanically, the problem isn't technical — it's communication about what the rule is for.
The question that unblocked code reviews for me: "what concrete problem does this change solve?" If someone wants to split a thirty-line function, the answer can't be "because functions should be at most twenty lines". It has to be "this block has a separate responsibility that will be reused" or "this block can't be tested in isolation the way it is". Without a concrete answer, the rule is being applied by inertia, not judgment.
The other side matters too: review your own work before asking for review. Half of the dogmatic comments come from a badly presented diff — a forgotten debug log, dead code, a rename mixed with a behavior change. The checklist I use is in review your own diff before opening a PR.
Frequently asked questions
Is Clean Code still worth reading in 2026? What about the 2nd edition?
Yes, read as a book of principles rather than a rule manual. If you're buying now, get the 2nd edition (2025): it's a rewrite with examples in several languages, it covers SOLID and architecture, and it has an appendix on the criticism of the book. Read it alongside A Philosophy of Software Design or the Martin–Ousterhout debate to get the counterpoint.
Is SOLID the same as Clean Code?
No. SOLID is a set of object-oriented design principles Martin popularized; the 2nd edition of Clean Code now covers both in the same book. SRP and DIP have clear practical application; OCP and LSP depend heavily on context. More in SOLID principles explained with examples.
Is Clean Code the same as Clean Architecture?
No. Clean Code deals with code at the level of functions, names, classes and tests; Clean Architecture deals with boundaries between layers and the direction of dependencies. You can have one without the other, and both carry the same risk of turning into dogma.
How do I get my team to stop applying rules mechanically?
Don't convince with opinion — show it with an example. Next time a rule shows up in a review without justification, ask what problem it solves in practice. And configure the linter for what has real payoff (very high complexity with a threshold the team calibrated, circular dependencies, inconsistent names), turning off what only produces false positives.
Clean code is reading cost, not appearance
The question that matters isn't "does this code follow the rules?". It's: "will the next developer who touches this understand what's happening, why the decisions were made, and be able to change it without introducing bugs?" If yes, the code is clean enough, regardless of lines per function. If not, no linter fixes it: what's missing is judgment, not another rule to memorize. Read the book — preferably the 2nd edition —, keep the principles, and ask for the why behind every rule in review. Before opening a PR, I paste the before and after versions into a text diff checker to see what I'm actually delivering with some distance from my own code.
- 01 CPU Cores vs. Threads: What Actually Changes in Practice Understand the difference between CPU cores and threads and what actually changes for performance, multitasking, gaming, and development.
- 02 MIT, Apache, and GPL Licenses: Practical Differences for Developers MIT, Apache 2.0, and GPL are not the same thing. Understand permissive vs copyleft, patent protection, and compatibility before shipping code to production.