Clean code, dirty code, human code
Tags: webdev, beginners, javascript, career
Published: 2020-01-19 16:37:13

---
title: Clean code, dirty code, human code
published: true
description: Let’s stop judging each other’s code. Instead, let’s work together to make our codebases better.
tags: webdev, beginners, javascript, career
cover_image: https://source.unsplash.com/FIy2C-oZPgA/1000x620
---

_Cover photo by [Dan Wayman](https://unsplash.com/@theamazingdjw?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/s/photos/bath-time?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)_

Last week, Dan Abramov posted a very personal and humbling blog post entitled [Goodbye, Clean Code](https://overreacted.io/goodbye-clean-code/).

I saw a tweet about this in my timeline and, being a long-term proponent of “clean” code, TDD and things of that ilk, I was naturally concerned. Here’s what I replied with.

{% twitter 1216374335067316225 %}

I dislike Twitter because it’s so hard to find any nuance to arguments. So in this post I’ll explain what I mean by **human code**.

## It’s easier to blame code than it is ourselves

I think it’s wonderful that Dan is blogging about deeply personal experiences in his career.

Many programmers who become team leads will have had a similar experience to the one he is describing. That time when your colleague wrote some code that you didn’t like so you rewrote it, because you wanted your codebase to be the best it could possible be. Then all hell broke loose. You offended your colleague, you made it awkward for the rest of the team, and your boss had to step in and sort it out.

At some point it dawns on you that **being a team lead means leading from the back**. That your team will only ever go as fast as the slowest person on your team, and your job is to help everyone level-up, not just yourself.

There were a bunch of people who replied to Dan’s tweet about his blog post with the same comment. Isn’t it interesting how common this experience is in tech?

## Human code

We are getting to the crux of what I mean by **human code**. It is code that has been written with a *people first approach*.

I am unsure who first said the following expression, but I first heard it at the [SoCraTes 2019 unconference](https://socratesuk.org/). (Please let me know who said this, if you know!)

> The two hardest problems in computer science are people, and convincing people that people are the hardest problem in computer science.

Isn’t that a wonderful saying? In my work as a software consultant helping businesses solve their software problems, almost always the biggest problem I see is interpersonal issues that stem from disagreements about project direction and structure.

## Clever code

Another problem here is what does “clean” mean? It does _not_ mean the shortest code, or the code with the most intelligent abstraction.

Take the acronym DRY (_Don’t Repeat Yourself_), which people misunderstand all the time, and then invent other acronyms like WET or AHA. We don’t need these acronyms. DRY is fine. It’s a topic that deserves a whole blog post on its own, but for now let me just say that there’s _another_ term that helps understand the issue.

It’s the term *clever* code. I like this term because it brings to mind the image of the lone wolf, “10x” coder who is trying to prove themselves better than everyone else around them. This behavior is toxic. Clever code is toxic because it takes a disproportionate amount of time to read and maintain it. Clever code is a ticking time bomb.

And by the way, there’s no judgement here from me, because clever code is _my_ default mode when I’m working alone. But I write much better code when I’m pairing with people. **Working with others is a great way to block clever code from ever appearing.**

So that is where the idea of **clean code over clever code** comes from.

But...

## Clean code _is_ dirty code!

Many of us in the [software crafters community](https://softwarecrafters.org) decided long ago to **stop using the word “clean” to describe our code**.

The problem is that by saying “clean” we are implicitly stating that some code is “dirty”. This can be very shaming for people. Particularly for beginners, it’s an example of the kind of word that leads to imposter syndrome, and a feeling that your code just isn’t code enough.

If you’re following the principle of **human code** then you want to avoid anything that could possible trigger negative responses in your colleagues, and that includes using the word _clean_.

It was [Tobias Goeschel](https://twitter.com/w3ltraumpirat) who first introduced me to the term *clear code* as an improvement on clean code. When I discussed this post with him, he reminded me that there’s a further problem with clean, and that’s the illusory binary distinction of clean vs dirty. All the code we write involves trade offs, and it’s not helpful to believe that there is always one right way of doing things.

Just like how DRY code isn’t a binary thing either. People hate on DRY because they believe it _is_ a binary thing&mdash;it’s either DRY or it isn’t&mdash;but in reality DRY is just a gentle nudge in the right direction of code quality.

## Yes, I care about code quality. But I also care about people.

Let’s stop judging each other. Let’s work together to create awesome software. 🤗