3 ms·
Spending time to understand the author’s intent of some code is one of the hardest parts of reading code. It’s like when you find a nil-guard in a function. Yo
by wild_preference 8y ago
Spending time to understand the author’s intent of some code is one of the hardest parts of reading code.
It’s like when you find a nil-guard in a function. You can’t truly refactor it until you know whether it was added defensively just-in-case or whether nils can still exist in the system at the function’s callsite, calling for further upstream examination.
There’s a certain hell in trying to follow a code base where every function is infected with ‘if (!arg) return’.
- AgentME 8y agoAfter dealing with code absolutely plagued with that pattern, languages with non-nullable types are amazing (Flow, Typescript in strict mode, Kotlin, Rust, ...) and I don't think I'm ever going to voluntarily switch away from them now.