Re:The ten years bug: solving a bug that wont go away
by partycoder on Tuesday September 20, 2016 @04:01PM
(#12542833)
Explicitly saying "I want 10 years" is different than saying "a large number. Do the math to know more". This is how identifiers can help understanding the programmer intention.
Then, you can define the time length as an arithmetic operation. Such as 10 * (60 * 60 * 24) * 365.
These might be still considered magic numbers to certain extent, but it's simpler to recognize numbers such as 60, 24 and 365.
Exposing this value as an external configuration parameter in a place that is more often looked at might have helped someone to realize caching might be an issue earlier, but it could easily have been ignored as well.