The cost of cleverness

Clever code is a loan against future readers. It pays out fast, at write time, and charges interest every time someone else opens the file.

What clever code looks like

A one-liner that chains five operations. A bit trick instead of a named check. A regex that replaces ten lines of parsing. An abstraction that covers cases nobody asked for yet. Each one is smaller than the plain version, and each one hides how it works.

Why it feels good to write

Clever code is a small win you get right away. You solved the problem in fewer lines, you used a trick you just learned, and the code looks impressive in the diff. That reward lands the moment you write it.

Who pays the interest

The next reader pays. Often that reader is you, six months later, with no memory of the trick. They have to reconstruct the reasoning before they can trust the code, let alone change it. A plain version would have cost more lines and saved that reconstruction time.

When cleverness is justified

Sometimes it earns its keep. A hot path that a profiler flagged. A proven bottleneck with a benchmark to back it up. In those cases, write the clever version, but leave the plain one in a comment or a test, so the next reader can see what the trick replaced.

The default

Write the boring version first. Only reach for clever when you can point at a number that justifies it.