Skip to content
</>Codeo's
Workshop
Clean Code

Writing Code That Tells a Story

Good code is read more often than it is written. Make it worth reading.

</>

By Codeo

May 10, 2025 · 6 min read · Intermediate

Every time we write code, we're not just giving instructions to a computer. We're communicating with another human — or with our future self.

Great code has a structure, a flow, and a purpose. It tells a story.

1. The Code is Read More Than It's Written

Most of the lifetime cost of software comes from maintenance. That means readability determines everything.

// Code is read more often than it is written.
// Make it easy to read.
language: js

2. Name Things Well

Names are the chapters of your story. Good names remove confusion.

// Bad
int d;
List<T> list;
boolean f;
// Better
int userAge;
List<Order> pendingOrders;
boolean isEligible;

A name should answer three questions: what it holds, why it exists, and how it is used. If a name needs a comment to be understood, the name is the thing that needs work.

3. One Thing at a Time

A function that does one thing can be named after that thing. A function that does five things gets a name with "and" in it — that is the smell.

  • Extract the steps until each level of the function reads like a sentence.
  • Keep the levels of abstraction inside a function consistent.
  • Let the call site tell the what, and the body tell the how.
If you cannot name it, you do not understand it yet.

4. Make the Intent Obvious

Comments explain why. Code explains what. When a comment describes what the next line does, delete the comment and fix the line.

// Write code that tells a story
function createClarity() {
  return cleanCode +
    thoughtfulDesign +
    empathy;
}
language: js

5. Tell a Story, Not a Mystery

Mystery code makes the reader hold everything in their head at once. Story code hands them one idea at a time and trusts them with the rest.

Write code that tells a story. Write it well. Write it clearly. Write it simply. Write it for others to read.

Uncle Bob

6. Final Thoughts

Clean code is not a style guide you obey. It is a kindness you extend to whoever opens the file next — and that person is usually you, six months from now, at midnight.