Re:Good Design is Imperfect Design, Part 1: Honest Names
by ericevans on Wednesday August 04, 2021 @05:23PM
(#28066517)
This is definitely the sort of idea that I like when exploring and trying to find a better model. The point I was trying to make in the article is that there are times when, however you try, you don't find a satisfying answer in the time you have.
Re:Good Design is Imperfect Design, Part 1: Honest Names
by ithkuil on Thursday August 05, 2021 @03:16AM
(#28070804)
Your point was good. But perhaps your unfortunate example is in turn a good example that if you can't find a good name for something perhaps there is a different way to look at things that produces a less contrived (but still explicit and honest) naming scheme.
Looking forward to read about your explorations on that front.
Re:Good Design is Imperfect Design, Part 1: Honest Names
by slaymaker1907 on Wednesday August 04, 2021 @04:30PM
(#28065904)
That's not really always possible/practical. It's pretty common to say "in three months from now" in which case defining a month to be 31, 30, 29, or 28 days is not correct. The plain English meaning is to be on the same day of the month, but add 3 to the month value, probably rounding down if necessary. Therefore, 3 months from January 31st 2021 would be April 30th despite going through February which has 28 days.
Re:Good Design is Imperfect Design, Part 1: Honest Names
by travisjungroth on Wednesday August 04, 2021 @04:36PM
(#28065981)
I think the point of the person you're replying to is to move the ambiguity onto the month object and off the plus operator. So today.plus(1 monthish) rather than today.plusish(1 month).
Re:Good Design is Imperfect Design, Part 1: Honest Names
by hcarvalhoalves on Thursday August 05, 2021 @11:48PM
(#28083125)
It may be common and still completely ambiguous what “3 months from now” means — ask people around and you’ll get different answers.
- Same calendar day plus 3 calendar month, round down if < end of month
- Just plus 3 calendar month plus remaining days if > end of month
- 90 days from now
Re:Good Design is Imperfect Design, Part 1: Honest Names
by chii on Wednesday August 04, 2021 @11:27PM
(#28069494)
but this breaks down when the destination date is not within the calendar days of the month. For example, what is 3 months from Nov 30th? Should it be Feb 28th (or, if it's a leap year, should it have been 29th?), or should it be Mar 2nd?
Re:Good Design is Imperfect Design, Part 1: Honest Names
by Xophmeister on Wednesday August 04, 2021 @06:40PM
(#28067389)
I came across this problem once before and came to the same conclusion. “A month” is an ill-defined unit, so I just don’t allow it to be representable in datetime arithmetic. You make the point that “1 day” would also fall under this category, but it’s less variable and so it being equal to “24 hours” is good enough.
Re:Good Design is Imperfect Design, Part 1: Honest Names
by ithkuil on Thursday August 05, 2021 @03:11AM
(#28070780)
One can argue that when something works most of the times until it breaks in some edge cases (twice a year) it's actually more dangerous since you're unlikely to encounter those issues until it hits all of your customers at once.
Not all months last the same number of days, and while we are at it not all days have 24 hours!
I'd rather move the explicit (and complicated) choice of what kind of month are you talking about (and thus also the relevant discussion about naming) into the operator that constructs a time interval.