3 ms·
I agree. I used to argue like the author, that null is a thing in computing and I just had to deal with it. But after spending some time in Rust and Swift, I l
by algesten 10y ago
I agree. I used to argue like the author, that null is a thing in computing and I just had to deal with it.
But after spending some time in Rust and Swift, I learnt a whole new way of thinking about it. The killer combination is:
no null + immutable
I've taken this to javascript, and it is so much better. Just don't accept null values anywhere in the model code, and suddenly writing view code is super easy.
No more endless if-cases or ternary to deal with nulls.
- gagege 10y agoYes. I usually refer to them as "optional" values, rather than "nullable" values. Something should only be null if it is truly optional to the class, view or whatever, which is a pretty rare thing. If a class requires a certain value to be able to do it's work, and that value is missing (null), why was the class even instantiated? That should be a big no-no.