The other day, I was talking about software design and the subject of hardcoding values came up. Someone said that there probably are cases where hardcoding of values was a sound idea. I replied that the mark of a good software designer would be that when it was suggested to hardcode Christmas day as December 25th, they’d stop to think, then come up with at least one valid reason why it might not be a great idea.
Now, I’m not sure that was such a particularly profound statement as it seemed when I was saying it, but I thought it might be fun to try to draw up an exhaustive list of reasons not to hardcode Christmas day as Dec 25th, so…
Firstly, Christmas day isn’t Dec 25th in some parts of the world.
The product might be used in a market where Christmas doesn’t happen at all.
Whatever purpose there might be for encoding Christmas=Dec 25th in the product, there may be an indefinite number of other dates that need to be treated in the same general way - and some of those might be variable, so it makes sense to develop a single coherent method for handling them all.
Is there not some concievable set of circumstances, however unlikely (civil emergency, death of a monarch?), that might contrive to cause Christmas (at least insofar as it pertains to the product) to be adjusted?