All posts
craft2025-11-22·1 min read

The art of writing less code

The best code is the code you never write. Some thoughts on restraint in software engineering.

Junior developers write code. Senior developers delete code. The best engineers write the least code possible to solve the problem.

Less is literally more

Every line of code is:

  • A line that can break
  • A line someone has to read
  • A line someone has to maintain

The fewer lines, the fewer problems. It's that simple.

Practical tips

Before writing a function, ask: does this already exist in the standard library?

Before creating an abstraction, ask: will this be used more than twice?

Before adding a dependency, ask: can I write this in 20 lines?

// Don't do this
const isEven = (n: number) => n % 2 === 0
const isOdd = (n: number) => !isEven(n)

// Just use the expression inline
if (count % 2 === 0) { ... }

The deletion mindset

Every PR review, I look for things to remove. Dead code, unused imports, overly clever abstractions that nobody understands.

Deleting code feels scary at first. Then it feels incredible.

Filed undercraft