An empty podium for first, second and third place.
  1. Code never written
  2. Code never read
  3. Code never changed
  4. Code telling a story

The best code is the one we never write. Perhaps user research shows that there will be no value. Or there might be a library we could use, or some service.

If we have to write code it should have an interface so clear that it tells all there is to know. If the code can be trusted, and we know how to use it, there is no need to read it.

If we need to read it, at least it should have so little responsibility that there is only one reason to change it. And if there is only one reason to change it, nothing else should be at risk breaking due to that change.

If we have to change it, like really change it, keeping some functionality and changing other parts. Then it should at least tell us so much about it self that we know what is going on.

This is my code type top-list. What is your favourite kind of code?

Comments

1. Michael Große

"The code that has been deleted." Would maybe be part of my "best kinds of code"-list. Maybe it was part of a prototype from which have learned all that we could learn. Or of a feature that is no longer needed. Or some utility that has been replaced by a library. We should not get attached to code and be happy to remove it. Maybe we should have a Marie Kondo-attitude to it: thank our code for its service and then let go of it to make space in our minds for new experiments :)

2. EsterDaniel Ytterbrink

Yes! It is definitely one of my favorites as well . Even though I do not know where to put it in the list to keep the flow of the text. It is a sibling to code that is not changed, since the mindset of one reason for change also creates code that is easy to delete.

3. Michael Große

True. No need to explicitly put it in the list. Additions and related thoughts like this, are exactly what a comment section is there for 😊

Related texts

A single frosted leaf with clear contours and veins.

TDD in the context of writing code to be read

Wunder Baum hanging from a car window (Known as Little Trees in most English-speaking countries)

Wunderbaum testing