Skip to content
Back to Thoughts
Thoughts1 min read

The best code is no code

engineeringsimplicityphilosophy
Share

Before writing a function, search for a library that does it. Before adopting a library, ask if you need it at all.

I've watched engineers spend two days building a custom date formatting utility when Intl.DateTimeFormat exists in every browser. I've seen teams add a 50KB library to format a single timestamp. Both are wrong.

The evaluation order should be:

  1. Can I remove the requirement entirely?
  2. Can a built-in API handle it?
  3. Can a well-maintained library handle it?
  4. Do I need to write this myself?

Most code exists to solve problems that shouldn't exist in the first place. A feature that requires 500 lines of custom parsing might indicate the data model is wrong. A utility that transforms between two formats might mean one format should be eliminated.

Every line of code is a liability. It needs to be tested, maintained, understood by future readers, and debugged when it breaks. The best code is the code you didn't write because you solved the problem at a higher level.


Share

More in Thoughts