Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Don't DRY Your Code Prematurely. Parent comment
Yes, we have repetitive date-checking logic, but we don't want lay a trap for the future. Not sure what language this is in so I'll use C#:
EnsureDateInFuture(DateTime Time) { if (Time <= DateTime.Now()) throw new Exception("Date must be in the future"); }
One check for the future, one copy of the error message, not locked in.
There are no comments on this comment yet.
Yes, we have repetitive date-checking logic, but we don't want lay a trap for the future. Not sure what language this is in so I'll use C#:
EnsureDateInFuture(DateTime Time) { if (Time <= DateTime.Now()) throw new Exception("Date must be in the future"); }
One check for the future, one copy of the error message, not locked in.