道 · 文
Kanso: simplicity in code
Kanso (簡素) is one of the principles behind Japanese aesthetics: beauty through the elimination of the non-essential. Not minimalism as a style, but simplicity as a result — what’s left after you remove everything that wasn’t earning its place.
It maps almost perfectly onto code.
The clutter we defend
Most complexity in a codebase isn’t there because it’s needed. It’s there because removing it feels risky, and adding it felt productive. We accumulate:
- Abstractions built for a second use case that never arrived.
- Configuration flags that have only ever held one value.
- “Flexible” interfaces that flex in exactly zero real directions.
// Before: flexible, configurable, and used in exactly one way
function formatDate(date: Date, opts?: { locale?: string; style?: 'short' | 'long' }) {
const locale = opts?.locale ?? 'en-GB';
const style = opts?.style ?? 'short';
// ...thirty lines of branching
}
// After: the one thing we actually do
function formatDate(date: Date): string {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, '0');
const d = String(date.getDate()).padStart(2, '0');
return `${y}.${m}.${d}`;
}
The second version is not “less powerful.” It’s honest about what it does. When a second requirement actually shows up, the cost of generalising then is lower than the cost of carrying speculative flexibility until then.
Subtraction as a practice
The hard part is that subtraction doesn’t feel like progress. There’s no green checkmark for the abstraction you didn’t write. But a codebase shaped by kanso is one where every part is load-bearing — and that’s what makes it calm to work in.
The discipline isn’t writing clever code. It’s being willing to delete it.