Why I stopped writing clever code and started writing code my team could read

Ingeniero de Software Dublín

Ingeniero de Software Dublín

Ingeniero Construido Para Escalar

Más Allá Del Código

Lo Que Dicen

Construyamos Juntos

Mensaje Recibido

Política de Privacidad

Términos de Uso

Política de Cookies

Aviso Legal

Últimas Noticias

Trabajo Seleccionado

Showcase

Lo Que Ofrecemos

Industrias Que Servimos

Más Allá De La Pantalla

Construido Juntos

View View
Nben Malla
Nben Malla

Software Engineer

Nben Malla is a software engineer based in Dublin, Ireland, specializing in microservices architecture, legacy system modernization and full stack development.

With experience across FinTech and SaaS, he has delivered scalable backend systems for global clients using Go, Java, Python, Django and Laravel, collaborating with teams across Nepal, Ireland, the Netherlands, New Zealand and the United States.

From leading legacy modernization for global banking clients to architecting microservices and distributed systems, the focus has always been to understand the problem deeply, build it right and deliver software that lasts.

  • Leer artículo Leer artículo

    Blogs 7 mins

    Why I stopped writing clever code and started writing code my team could read

    Nben M. 26 Jul, 2026 7 mins

    Why I stopped writing clever code and started writing code my team could read

    Three years ago I wrote a Go function that collapsed a twelve step validation pipeline into four lines using nested closures and a generic dispatch table. I was proud of it. Six months later a teammate asked me what it did, and I could not explain it without opening the code and tracing it line by line myself.

    That was the moment I stopped treating clever code as a skill worth showing off. On the Standard Chartered Ireland migration, I watched engineers burn entire sprints untangling code that worked but nobody understood. The cost was not theoretical. It showed up in delayed releases, duplicated logic because nobody trusted the original implementation, and bugs that survived code review because reviewers could not follow the logic well enough to catch them.

    Clever code optimizes for the moment you write it. Readable code optimizes for every moment after that, which is most of a system's life.

    What Clever Code Actually Costs

    Clever code trades short term elegance for long term comprehension debt. The person who benefits from the cleverness is the author, at the moment of writing. Everyone else pays for it later, including the author six months on.

    I have seen this pattern repeatedly in Laravel codebases inherited from previous teams. A developer builds a macro system or a trait chain that handles five edge cases in one elegant abstraction. It works. Then a new requirement comes in that does not fit the abstraction, and instead of extending it, the next engineer works around it, because nobody wants to touch the clever part.

    The Debugging Tax

    Debugging clever code takes longer because you cannot reason about it locally. You need to hold the entire abstraction in your head before you can trace a single execution path.

    go
    // Clever: hard to trace without holding the whole dispatch map in your head
    handlers := map[string]func(ctx context.Context, p Payload) (Result, error){
        "validate": compose(checkSchema, checkAuth, checkLimits),
        "process":  compose(enrich, transform, persist),
    }
    result, err := handlers[action](ctx, payload)
    go
    // Direct: each step is visible and traceable on its own
    func handleValidate(ctx context.Context, p Payload) (Result, error) {
        if err := checkSchema(p); err != nil {
            return Result{}, err
        }
        if err := checkAuth(ctx, p); err != nil {
            return Result{}, err
        }
        return checkLimits(ctx, p)
    }

    The second version is longer. It is also the version I can debug at 2am during an incident without pulling up three other files to understand what compose does.

    The Onboarding Tax

    Every clever abstraction becomes a teaching burden. New engineers on the migration team spent their first weeks learning our custom patterns instead of learning the domain. That is backwards. The code should teach the domain, not itself.

    I watched this happen with a junior engineer who joined the Standard Chartered project in his second month. He was sharp and had no trouble with distributed systems concepts. What slowed him down was a homegrown dependency injection pattern one of our engineers had built to save a few lines of boilerplate. He spent four days reading it before he could safely touch a payment handler.

    Compare that to a senior engineer we onboarded onto a simpler, more explicit codebase around the same time. She shipped her first production fix on day three, not because she was more experienced, but because the code told her exactly what it did without requiring a private lecture from the person who wrote it. Onboarding speed is not a soft metric. It is a direct signal of how much hidden cost a codebase is carrying.

    What I Changed in How I Write Code

    I now write code as if the next person reading it has half the context I have and half the time I had. That constraint changes almost every decision.

    Prefer Explicit Over Generic

    Generic solutions feel efficient because they reduce line count. But a generic solution built for one use case is often just an obscured specific solution. I write the specific version first and only generalize when a second real use case actually shows up.

    Early in the migration I built a generic retry wrapper that accepted a strategy function, a backoff function, and a predicate for which errors were retryable. It looked flexible on paper. In practice every service that used it needed slightly different behavior, so callers ended up passing in custom closures that were harder to read than a plain retry loop would have been.

    I replaced it with three separate, boring retry functions, one per service that actually needed retries. Each one was fifteen lines and readable top to bottom without jumping into a shared utility file. The line count across the codebase went up. The time it took anyone to understand a given service's retry behavior went down, and that trade is almost always worth making.

    Name Things for What They Do, Not How They Do It

    A function called processData tells you nothing. A function called validateAndPersistTransaction tells you what to expect before you read a single line of the body. Naming is not decoration. It is the fastest form of documentation available and it never goes stale the way comments do.

    Flatten Control Flow

    Nested conditionals and chained callbacks look compact but hide the actual decision tree. I flatten early returns and guard clauses so the happy path reads top to bottom without mental stack tracking.

    python
    # Nested: reader has to track three levels of state
    def process(order):
        if order.is_valid():
            if order.has_stock():
                if order.customer.is_verified():
                    return fulfill(order)
        return reject(order)
    python
    # Flat: each condition is a checkpoint, not a branch to remember
    def process(order):
        if not order.is_valid():
            return reject(order)
        if not order.has_stock():
            return reject(order)
        if not order.customer.is_verified():
            return reject(order)
        return fulfill(order)

    Delete Abstractions That Only Serve One Caller

    If an interface has exactly one implementation and no plan for a second, it is not abstraction, it is indirection. I remove these on sight now. Every layer of indirection is a layer someone else has to unwind to understand what actually runs.

    How This Changed Code Review

    Once readability became the standard, code review conversations shifted. Instead of debating whether an approach was clever enough, we debated whether a new engineer could understand it without a walkthrough. That is a much more useful bar to hold a pull request to.

    It also made incidents shorter. When production breaks, the engineer on call is rarely the one who wrote the code. Readable code means that engineer can orient themselves in minutes instead of pulling in the original author at 3am.

    Conclusion

    Cleverness in code is not a virtue on its own. It is only worth something if it reduces total cost across the life of the system, and in my experience it almost never does. The engineers who impressed me most on the Standard Chartered migration were not the ones writing the most compact code. They were the ones whose pull requests needed the fewest questions.

    I still enjoy an elegant solution when I find one. But elegance now means clarity, not compression. A system that a tired engineer can understand during an incident is worth more than one that impresses reviewers during a demo.

    The best code I have shipped in the last two years is code nobody remembers reading, because it did exactly what its name said it would.