Theory of Zen
15 AugustConsider the following:
All TuringComplete languages are equivalent modulo AccidentalDifficulty. Therefore, AccidentalDifficulty, of the two forms above, is the only thing that matters when objectively comparing GeneralPurposeProgrammingLanguages.
Where “AccidentalDifficulty” is all things not essential for the solution but present nonetheless. E.g. boilerplate code, compiler commands, type definitions, hoops to jump through, etc.
Combine that idea - that two turing-complete programming languages only differ in the non-essential boilerplate parts - with this nugget of knowledge:
Checking for null is almost always an implementation detail, not a part of the domain you are modeling. As such the null check should be isolated to the boundaries of your code, or eliminated altogether.
At first this looks like “null checks” are a completely different topic, but it’s saying the same thing. If it’s not part of the domain you’re modeling then it’s an “implementation detail” ← this is another way of saying “Accidental Difficulty”.
And what does Avdi recommend be done with this “null check” a.k.a. “implementation detail” a.k.a. “Accidental Difficulty”?
Isolate it or eliminate it.
This is a core practice in zen code. Zen code strives to have no more than essential and no less.
A Modern Take
Recently, a mild flame war broke out on Twitter over this:
It’s the exact same thing in modern meme-speak.