It’s been a long and tiresome week of work, and you want a vacation.
You search online for some decent vacation spots.
Hawaii? Nah. Canada? Already been there.
But hold on, something catches your eye. Null Island? Thousands of visitors? And look at that population density! All those posts from (0,0)?
And so you set out on an arduous and dangerous journey to Null Island, only to find this.
Yep. Null Island, the most popular tiny island you’ve found in your life, doesn’t exist.
What’s Going on Here?
Null Island, located with the geographic coordinates (0,0), is a byproduct formed by bad programming.
How did it happen?
Some developers who were creating a GPS system decided that, if a person’s coordinates couldn’t be found, that instead of setting them (Null, Null), they were instead set to (0,0).
In psuedocode, it went down something like this :
if user's x coordinate is Null set user's x coordinate to 0 if user's y coordinate is Null set user's y coordinate to 0
Not only is this kind of code an anti-pattern, but for something such as position tracking, this can have serious consequences.
For example, in Wisconsin, many voters were in locations that did not have registered coordinates. However, in order to vote, they needed to use a new geocoding system that tied their house address to a geographical coordinate.
Unfortunately, the Wisconsin voters were given a geographical coordinate of (0,0), or Null Island. For a population of nearly 6 million, the problem was quickly discovered and fixed, but it is yet another example of how bad programming can wreck havoc.
To prevent mistakes like these, ask yourself if what you’re doing makes sense in a different context.
Here are some similar scenarios, using the same logic that caused the Null Island issue.
if user's phone number is Null set user's phone number to 000-000-0000 if user's pin number is Null set user's pin number to 0000 if user's credit card number is Null set user's credit card number to 0000 0000 0000 0000
In scenarios where the 0 is significant, you cannot replace null with zero. If your wallet is null, it means you don’t have any money. Your balance is 0. If your friend count is null, it means you have no friends, so your friend count is 0.
However, if the zero matters, such as in a phone number, you can’t set the user’s phone number to 000-000-0000. Similarly, if you have an expensive watch, and the price is null because it’s not for sale, that doesn’t mean your watch costs $0.00. That would imply that you’re giving it away for free.
Null Island is a silly coding mistake that carries significant consequences, even today.
That’s not to say that every single mistake you make will effect an entire state’s voter population, but it can happen.
If you want to avoid creating the next equivalent of Null Island, leave your user’s input as is instead of attempting to change it. Null means null. Leave it as null.