Hacker News new | ask | show | jobs
by patio11 6319 days ago
With computerized registries, age surely starts at zero

Except that, by convention, in China what you consider zero is already "0 years 9 months".

Its similar to describing the epoch time to my colleagues. You know, epoch time: the number of seconds which have passed since midnight (GMT) on January 1st of the 45th year of the Showa era.

Incidentally, you want to have some fun in outsourcing? Try convincing your Indian outsourcing team that it is Very Bloody Important that their code account for the edge case when the last day of one era and the first day of another era fall on the same day of the Western calendar. ("The data are passed in as strings, the strings are always in the same format, why can't we use string compare? It saves the conversion into a date." "That is premature optimization and will introduce a bug for the following dates:..." "There's only a few of them!")

1 comments

That was what I meant when I said zero is zero years and so many months. Using integers (or even decimals) and without rounding, 0 years and 9 months is really zero. One will start 12 months (or the number of months the calendar is using) after the date of birth.

Edge cases, I would estimate, would account for 30% of a program's logic. When doing the first cut, I classify those as exceptions: abnormal values that generate, well, exceptions.

Time-bound edge cases are abundant, especially in financial apps. End of periods, beginning balances, ending balances.

Other edge-case values are max and minimum values, limits of whatever sort. And these don't include limits of systems, like how many times a stored procedure can be dropped and recreated, that are not commonly known or just ignored hoping the app will hold before the longint limit will be reached.