Adam S sends us a representative line which represents a mystery. It's a simple enough Java statement:
private static final Integer[] DIRECTIONS = { 0, 1, 2, 3, 5, 6, 7, 8 };
There is no documentation, no commentary, no explanation of what, exactly, this is supposed to represent. Why did the developer choose to use Integer
and not the int
primitive type? Why is this just a sequence of numbers in order? Why is 4
missing from the sequence?
The only clue we have is to look at how this particular constant is used, but that is, sadly, no extra help: ``DIRECTIONS.length```. It leaves us with another question: why not just have a constant integer value?
The fact that there are eight entries is tantalizingly reasonable: North, North-East, East, etc. Except we include 0
and 8
, but exclude 4
, which doesn't make sense. Did the original developer want to suggest that there should be 8 possible directions, and didn't understand how counting works? Then they just deleted one number to make the numbers add up? Why 4 though? Was their fourth birthday a profound disappointment? Do they just consider 4 unlucky? It is the only number in the list which is the square of a prime, so maybe there's a deep numerological significance to their choice?
In the end, we must simply admit: we have no idea what this developer was doing. We are in good company, though, for it seems likely that this developer also had no idea what they were doing.