Simple is better than complex
Key takeaway: Treat simplicity as work you do on every change, and say no to each layer the current code does not need.
Complex code is the default. Simple code takes effort, because you have to understand the problem well enough to remove what doesn’t need to be there.
Think through a problem one case at a time and you get a tangle of branches that technically works. No discipline required. That’s why over-engineering is so common. Adding layers and options feels like building something solid.
Simple isn’t the same as easy. Easy is whatever you reach for first. Simple is what’s left after you cut what doesn’t need to be there. The Zen of Python follows “simple is better than complex” with “complex is better than complicated” because some problems really are complex. The point is to avoid adding accidental complexity on top.
So before you add something, ask whether the concrete code is actually hard to understand or you just want an abstraction, whether anyone will ever change this option, and whether these pieces are really independent. Usually the answer is no.
Here’s the configuration question in practice:
# invoice.py: options for every way a total could be shown
from typing import Literal
def format_total(
cents: int,
currency_symbol: str = "$",
decimals: int = 2,
symbol_position: Literal["before", "after"] = "before",
) -> str:
amount = f"{cents / 100:.{decimals}f}"
if symbol_position == "before":
return f"{currency_symbol}{amount}"
return f"{amount}{currency_symbol}"
Every caller uses the defaults. The business bills in dollars and has never asked for anything else. That’s three options to read and test for behavior nobody uses:
# invoice.py: the one way totals are shown
def format_total(cents: int) -> str:
return f"${cents / 100:.2f}"
If the business starts billing in euros, that change will come with real requirements, and the function is short enough to rewrite then.