Hacker News new | ask | show | jobs
by celoyd 4651 days ago
I took a break from dealing with an in-band null problem in image data to check HN, and here’s this. Oof.

Don’t represent missing data with a value in the same domain as real data.

Maybe I’m just grumpy, but that seems like a clear, persuasive, and generally realistic goal. In cases where you’re constrained to break that rule, at least approximate it. For example, if you’re stuck using strictly floats for a percentage like this one – without recourse to an undefined/null/none type – you can still use -1.0 or Inf or NaN and not draw the lines.

1 comments

You're not just grumpy. I think this is a good practice in general. Or maybe it's just you and I; when someone does not do this, I go cross-eyed.

It does introduce the null reference problem, but that's what it's there for and if you're not going to invent a nil-object, let's not try to paper it over. IMHO it's better to make it explicit.

I think this graph is awesome, BTW; I just liked your comment. I sympathize with folks putting something together quickly, for fun, and of course we've all written bugs into our programs. I also enjoy discussing programming philosophy.