Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Nice explanation. Bet a lot of devs, including me, will yearn for a slice after reading your rant.
-
Karam108yThis is brilliant! Particularly given that this is a concept that many fail to grasp, I think you've just cracked the best possible way of explaining it ever :D
-
prashanth868y@molynerd Thanks for your useful rant!! Can you please add what is undefined? I was asked the difference between NULL and undefined recently in a interview..
-
@prashanth that would be "if we've decided to get food, but haven't chosen the kind, it's undefined"
-
@imaduck Then you'll get a nullref exception if you try to put the pizza in the box?!
-
It's not entirely correct anyway. There are five kinds of null: TBA, N/A, DNC, UNK and 0.
Nulls are metavalues.
TBA (to be advised) we don't currently know but we do know that we will know.
N/A (not applicable) field is meaningless in this context.
DNC (do not care) user chose not to provide this information.
UNK (unknown) we don't know and we don't even know why we don't know, whether we might eventually know or even whether there's anything _to_ know.
I argue that 0 (zero) is a null because in addition to 0 bananas on my desk there is an infinity of other things present on my desk in 0 quantity. It's a metavalue indicating absence and it usually has contextually implied type.
Me: 1 is something, 0 is nothing, NULL is the absence of things
JuniorDev: wut
Me: You've got pizza in a box, that's 1. If there's no pizza in the box, that's 0. If there's no pizza and no box, that's NULL.
JuniorDev: OOH so there's no object to reference if I ask for a slice!
Me: *small tear*
Always explain things in terms of pizza. Always.
rant