# Is "Clean Code" still good advice?

By Vishal Kumar · Published 2026-08-10 · Updated 2026-11-13
Source: https://fungyaan.com/p/is-clean-code-still-good-advice
Tags: how-we-build, clean-code, code-review, design

**The verdict, as the cases below will bear out:** yes for the goals, not always for the rules.
- **Keep:** clear names, functions that do one job at one level of detail, small blast radius for changes, tests that pin behaviour, and leaving code better than you found it.
- **Bend:** "functions should be a few lines long", "comments are a failure", and "never repeat yourself". Followed literally, they produce code that's harder to read, not easier.
- **The test that matters:** can someone new read this, understand why it does what it does, and change it without breaking something far away?

The case usually starts in a code review. A perfectly readable function gets flagged as "too long", a helpful comment gets deleted as "a failure", two simple exports get merged into one clever abstraction, and somehow the code ends up harder to change than before. The book gets blamed, or the reviewer does. Neither is quite the culprit.

Robert C. Martin's book (2008) gave a generation of us a shared language for talking about code quality, and that alone is worth appreciating. It's best read by taking the goals to heart and treating the rules as advice from an experienced colleague rather than law.

> **Case file**
>
> | | |
> |---|---|
> | **The case** | Code reviews flag clear functions as "too long" and the code ends up harder to change |
> | **Suspects** | The book, the reviewer |
> | **Culprit** | Following the rules literally instead of the goals |
> | **The fix** | Keep the goals, bend the rules: split by level of detail, comment the why |
> | **Evidence** | The blogging platform's sign-up handler, about 50 lines in one function |

## The suspects: the rules, one by one

Each rule started as a good observation; here's where each one helps and where it tips over.

| Rule | When it helps | When it hurts | What I do |
|---|---|---|---|
| **Meaningful names** | Always | When names get long and generic (`OrderProcessingManagerService`) | Name things the way the business does; short names for short scopes |
| **Small functions** | Splitting a function that mixes levels (SQL, rules and formatting in one place) | Splitting a clear 40-line sequence into eight 5-line functions you have to jump between | Split by level of detail, not by line count |
| **Do one thing** | Always, if "one thing" means one reason to change | When it becomes an excuse to fragment | One job per function; a job can take 50 lines |
| **No comments; the code explains itself** | Comments that repeat the code | Code can't explain *why*: the business rule, the incident, the trade-off | Comment the why, never the what |
| **DRY: don't repeat yourself** | The same rule in two places that must change together | Two things that look alike today but change for different reasons | Duplicate first; extract on the third time, if they really are the same rule |
| **Few arguments** | Spotting a function that does too much | Hiding arguments in fields or a vague options object | Pass what's needed, explicitly |
| **Tests first-class** | Always | When tests mirror the implementation so tightly that every refactor breaks them | Test behaviour through public interfaces |

## Case 1: a long function that's actually clear

**Situation:** a sign-up handler validates the form, checks rate limits, hashes the password, creates the account, sends a confirmation email and sets the session cookie. It's about 50 lines.

**What I'd do:** leave it as one function, if each block reads in order and stays at the same level of detail.

The handlers in the blogging platform I run look like this. You can read a request from top to bottom and see every step, every error path and every status code. Splitting it into `validateSignupInput`, `enforceSignupRateLimit`, `createAccountAndSendEmail` and so on would hide the order of operations, which is exactly what a security reviewer needs to see. Length was a red herring all along. A function that tells its story in order is easy to review.

**When to split:** when one block drops to a lower level (twenty lines of string parsing in the middle of the flow), move that block into a named function.

```mermaid
flowchart TD
  Q1{"Can someone point to a part that was hard to follow?"} -- no --> K["Leave it as one function"]
  Q1 -- yes --> Q2{"Does a block drop to a lower level of detail?"}
  Q2 -- yes --> S["Move that block into a named function"]
  Q2 -- no --> N["Fix the names or the order instead"]
```

## Case 2: premature abstraction

**Situation:** two endpoints both export CSV. A developer extracts a generic `Exporter` with options for columns, formatting, filters and encoding.

**What happens next:** the third export needs something slightly different, so the options grow. Soon nobody can change one export without checking all of them. The rule meant to prevent mess has quietly caused it.

**What I'd do:** keep the two exports as two simple functions with some repeated lines, and share only the common, stable part (writing a CSV safely, for example escaping values that spreadsheets would treat as formulas). As Sandi Metz put it, duplication is far cheaper than the wrong abstraction; the [design patterns post](/p/design-patterns-that-earn-their-place) lists the signs of an over-abstracted codebase.

## Case 3: the code review argument

**Situation:** a reviewer asks for a function to be split "because it's too long", the author disagrees, and the thread runs to twenty comments.

**What I'd do:** agree on the goal, not the rule. That small shift is the reveal here: it turns a standoff into a conversation.
- Ask a concrete question: "Which part was hard to follow?" If nobody can point to one, it's fine.
- Prefer changes that reduce what a reader must keep in their head: fewer variables in scope, fewer jumps between files, names that say what the business means.
- Write the team's choices down once (the [engineering standards repo](https://github.com/the-vishal-kumar/engineering-standards) has a code review guide) so the argument isn't repeated in every review.
- Leave style to formatters and linters.

## The real motive: what still matters most

Strip away the rules and the motive behind all of them comes into view. These ideas matter more than any rule from the book:
1. **Names from the domain.** Half of readability is the words.
2. **Consistent structure.** Similar things done the same way across the codebase.
3. **Small blast radius.** A change in one place doesn't break something unrelated.
4. **Errors handled where they happen**, with context, not swallowed.
5. **Tests that describe behaviour**, so refactoring is safe.
6. **Comments for the non-obvious**: why a limit is 8 and not 10, which incident a check came from.

> **Remember this**
> - Split by level of detail, not by line count.
> - Duplicate until the third time; the wrong abstraction costs more.
> - Comment why, not what.

## Case closed: what I'd do by default

1. **Write the straightforward version first**, top to bottom.
2. **Split by level of detail**, not by length.
3. **Duplicate until the third time**, then extract if it's really the same rule.
4. **Comment why, not what.**
5. **Settle style with tools and a written guide**, and spend review time on behaviour and risk.

The heart of "Clean Code" was always kindness to the next reader. That's the lovely thing hiding behind every rule, and once you see it, the arguments mostly resolve themselves. Keep that, and you can bend any rule with a clear conscience.
