Back to Blog

Coding for the "Next Guy" (Who Is Likely Just You, But Dumber)

5 min read

There is a specific type of arrogance that infects every developer around the 30-minute mark of a coding session.

You know the feeling. The caffeine has hit, the logic flows, and you are holding the entire complex state of the application in your working memory. You are a god. You don't need to explain why you just chained three ternary operators together; it's obvious. It's elegant.

Here is the cold reality: That context has a half-life of about 72 hours.

In six months, when a P1 bug report comes in and you open that file, the "God Mode" version of you is long gone. You will look at that elegant ternary chain and think: "Who is the absolute moron who wrote this?"

You check git blame. It was you.

Building for "The Next Guy" isn't altruism. It's self-preservation. The Next Guy is you, but tired, deadline-stressed, and completely devoid of the context you have right now.

Here is how to write code for that guy, moving beyond the useless advice of "just add comments."

1. Comments lie. Context doesn't.

The standard junior advice is "comment your code." This is usually wrong.

Comments have a nasty habit of drifting away from reality. You change the code, you forget to update the comment, and now the comment is a lie. A lie is worse than no documentation at all because it sends you on a wild goose chase.

Instead of commenting what the code does (I can read the code, thanks), comment on why it exists.

Bad:

Good:

The first comment explains the syntax. The second comment explains the business constraint. The syntax will rarely confuse Future You. The business logic will baffle him.

2. Embrace "Whippable" Code over "DRY" Code

We have been brainwashed to believe that Don't Repeat Yourself (DRY) is the holy grail.

So, we see two functions that look similar, and we abstract them into a single, generic "helper" function. Then a new requirement comes in for one of those cases. We add a boolean flag to the helper. Then another. Suddenly, you have a "helper" function that takes 6 arguments and contains 4 nested if statements.

This is "The Wrong Abstraction."

It is better to duplicate code than to create the wrong abstraction.

Copy-pasting a 10-line function is fine. Really. It allows you to modify one flow without breaking the other. "The Next Guy" would much rather read two explicit, slightly repetitive functions than try to untangle one generic "God Function" that handles 15 different edge cases.

3. Write Tests as Documentation, not just Validation

Most tests are useless for understanding a system. They check if 2 + 2 = 4.

If you want to be strategic, write tests that tell a story. When I open a new repo, I don't look at the README first. I look at the tests. If they are written well, they tell me exactly how the system is supposed to be used.

Don't name your test test_calculation_logic.
Name it should_throw_error_if_payment_currency_mismatch.

The error message in the test name tells me more about the system's constraints than the implementation code does.

4. Commit Messages are Your Diary

"Fix bug" is not a commit message. "Update styles" is not a commit message.

When you are debugging a production fire in six months, git blame is your only weapon. If the commit message says "wip", you are dead in the water.

Use the body of the commit message.

  • Why are we making this change?
  • What alternative solutions did we discard?
  • Who forced us to do this (link the ticket)?

If you had to hack around a library bug, say so in the commit. "Upgrading to v4 broke the layout, so I pinned this to v3.2 until they merge PR #455."

That sentence alone will save Future You three days of debugging when he tries to run npm update next year.

5. Leave "Breadcrumbs" for the hard stuff

Sometimes, the code has to be complex. You're doing bitwise operations for performance, or you're working around a browser quirk.

In these moments, don't be clever. Be loud.

Leave a "breadcrumb" link to the StackOverflow thread, the GitHub issue, or the obscure blog post that gave you the solution.

The Bottom Line

We often talk about "Technical Debt" as if it's just bad code. But the most expensive debt is Knowledge Debt.

Every time you write a "clever" one-liner to save 30 seconds today, you are borrowing time from your future self at a predatory interest rate.

Be kind to the Next Guy. He's going to be tired, he's going to be confused, and he's going to be you.