As the senior dev it was my job to provide info as needed and subtly assess the new, potential rockstar code ninjas.
Anyway, this new guy says "I store all my dates in sql as text in iso format so I can easily sort them".
As the senior dev it was my job to provide info as needed and subtly assess the new, potential rockstar code ninjas.
Anyway, this new guy says "I store all my dates in sql as text in iso format so I can easily sort them".
If he had said anything other than "in sql" it would be the correct answer.
"I store all dates in spreadsheets in ISO format"
"I prepend ISO dates to marketing campaign names so I can easily sort them in the horrible web frontends that doesn't have a sort by date option"
"I start all my blog entries with ISO dates..."
I mean, just... so close!
Strong SQLite vibes... (SQLite doesn't have a date format, it has builtin functions that accept ISO format text or unix timestamps)
Among the option of storing (date field, millisecond field) and (date as iso8601 text field with millisecond without time zone) I chose the latter, and I can’t tell for sure but it was almost surely the better choice.
I saw no benefit in storing two copies. That’s recipe for problems - e.g. “update” code that doesn’t update both, or somehow updates them differently (which one is right?). You can probably have t-sql or some “check” constraint to enforce equivalence, but ... why?
For most practical uses, an ISO8601 textual representation is as good, though a little less space efficient.
https://stackoverflow.com/questions/1732348/regex-match-open...
:)
Just point him in the right direction and move on.
I am way less judgemental now and a lot of the comments here are making me rethink what I thought about him saying this. He had a lot of other issues and resigned after a couple of days so I guess we'll never know what he was capable of.
EDIT: also I wouldn’t consider this egregious. If the Senior explains and the person was happy to learn something then that’s a good outcome. If they are stubborn about it, then that wouldn’t be great.
I've seen far worse things than this done to a SQL database though…
Just have a look at the list from Wikipedia [1] and notice how many repeats there are.
As an example AMT could be either UTC+4 or UTC-4.
And this doesn't even includes the various local acronyms that people use around the world.
[1] https://en.wikipedia.org/wiki/List_of_time_zone_abbreviation...
IANA time zone identifiers are fully-qualified and unambiguous like America/Los_Angeles or Asia/Kolkata.
If you don't use these, you will inevitably be somewhat wrong due to leap issues, political changes in time, or the like.
If you are trying to store dates and not timestamps, that’s what you want, otherwise equality tests might not work right.
> (The integers stored are usually POSIX timestamps.)
For date types, if they exist distinctly, usually not.