Writing Code Your Future Self Will Thank You For
A practical look at the habits that keep codebases readable months after you've forgotten why you wrote them: naming, structure, and knowing when to stop abstracting.

Six months from now, you will open a file you wrote today, and you will not remember why you made half the decisions in it. It's the default outcome of writing software, not necessarily your memory is failling. A better question to ask than: "how do I remember more?" is: "how do I write code or a thing that doesn't require me to".
(Don't worry, we'll also talk about agents writing things...)
Naming is the cheapest form of documentation
Most comments exist to compensate for a bad name. If you find yourself writing // check if user can checkout above a function called check(u), you've done the work twice (once in the comment, once in the code) and only one of those will stay in sync as the logic changes.
// Before
function check(u: User): boolean {
return u.cart.length > 0 && u.verified;
}
// After
function canUserCheckout(user: User): boolean {
return user.cart.length > 0 && user.verified;
}The second version doesn't need a comment. It doesn't need you to remember anything either; the name carries the intent, so that six months from now you can read it cold.
Structure reveals intent before you read a single line
A function's shape tells a story before its body does. Long functions with deep nesting say "there's a lot going on here and none of it has been named yet." Breaking a function apart isn't about hitting some arbitrary line count, instead it's giving each idea inside it a name of its own.
function processOrder(order: Order) {
if (order.items.length === 0) return;
const total = order.items.reduce((sum, i) => sum + i.price * i.qty, 0);
const discount = order.coupon ? total * order.coupon.rate : 0;
const finalTotal = total - discount;
if (finalTotal < order.minimumSpend) return;
charge(order.customerId, finalTotal);
sendReceipt(order.customerId, finalTotal);
}Compare that to:
function processOrder(order: Order) {
if (isEmpty(order)) return;
const finalTotal = calculateTotal(order);
if (!meetsMinimumSpend(order, finalTotal)) return;
executePaymentWorkflow(order.customerId, finalTotal);
}Nothing about the logic changed. What changed is that the second version can be read top to bottom as a sequence of decisions, and each helper is small enough to verify in isolation.
*Note that even without any comments in the code, it would be easy to perform maintenance.
Formatting is the baseline of readability. If your code layout is a chaotic heap, what could be clean logic turns into cognitive rubbish. But remember: your job is to reason, not to format. Leave the indentation and style guides to automated tooling on every save. Your code needs to be perfectly structured not because you spent time polishing it, but because a clean layout is the ultimate catalyst for humans and AI agents to understand your intent instantly.
Know when to stop abstracting
The flip side of this advice is just as important: not every repeated block of code needs to become a shared abstraction. Three similar lines are often better than a premature interface that has to be twisted to fit a fourth use case nobody anticipated (probably violating SOLID principles). Abstraction has a cost: it adds a layer of indirection between the reader and the behavior. Only pay that cost when the repetition represents the same idea, not just similar-looking code.
A good rule: if you need to add a boolean flag or a special case to reuse the abstraction, it probably wasn't the same idea to begin with.
⚠️ The AI Trap: Code agents and the atrophy of architectural thinking
Delegating code creation to AI agents has introduced a new flavor of premature abstraction. Large Language Models love patterns; they are trained to find symmetry, which means they will often refactor similar-looking lines into complex, over-engineered structures simply because they can.
When you let an agent dictate the boundaries of your architecture, you are alienating your own reasoning. You trade immediate speed for long-term technical debt, essentially enslaving your codebase to an alien logic you didn't actively reason through. Over time, outsourcing these micro-decisions atrophies your architectural muscle. If you let an AI decide when to abstract and when to duplicate, you will eventually find yourself unable to write, debug, or evolve the very system you claim to own.
The real test
The best check for whether code is clean isn't simply a linter or a style guide, but whether a teammate (or you, in six months) can make a correct change to it without first having to reverse-engineer what it does. Optimize for that, and most of the rest, naming, structure, comments, follows naturally.