The best kind of code
- Code never written
- Code never read
- Code never changed
- 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 😊
Comment on the blog!
Create a comment by emailing me.
Open an email to start writing.I will then add the comment to the post.