« first day (2111 days earlier)      last day (990 days later) » 

7:09 AM
Here is the latest episode of "Why sanity is a luxury in software development".
Some backstory: we have a system which allows the user to enter some data. When that is done, we add a timestamp "CollectedAt" in [ISO 8601 format] and in UTC because that preserves your sanity when using dates. Then we send all the data over to another service which will save it in the database. The other service is developed by a different team. They also add a "CreatedAt" and "ModifiedAt" fields. Yesterday, I had a look at the database and was shocked to see the following:
CollectedAt: 2021-07-30 14:13:50Z
CreatedAt : 2021-07-30 02:13:51Z
ModifiedAt : 30/07/2021 04:13:51PM
There is 1 second difference in the timestamps but that's OK. That's why we timestamp it before sending - the "Created" reflects when it was added to the DB, not when the user entered it. There might be a bigger gap.
However, the rest is insane. The "CollectedAt" is the only one that's correct - it's in proper ISO 8601 format and the time is accurate. "CreatedAt" says it was captured 12 hours earlier. The reason is that the other team decided to use 12-hour format but that is bizarre. Also, not according to the ISO 8601 standard.
"ModifiedAt" is just local time in a garbage local format. Makes it as hard as possible to read when handed over to any other system. Also, it's impossible to translate to other timezones without knowledge of which timezone it was written in.
/blog
 
7:46 AM
@Feeds Three can play at this game (red = mine)
looks like we all got the same answer :-p
 
@VLAZ How does 02:13:51 early in the morning look like? :D But to be honest.. this isn't about sanity. It's about incompetence. And not being capable of thinking things through.
 
@RyanM I think there is only one answer
 
Yeah, I think that's probably correct
I'm amused that we all managed to import the image at different resolutions
 
@Scratte Affects my sanity.
 
Dealing with dates in programming is the worst
 
7:51 AM
@RyanM It's not the dates. It's the humans that despite having a brain, refuses to use it.
 
Okay so consider the publication date for a book
How would you represent that in your data model?
 
@RyanM Yes
 
(this is absolutely a trick question)
 
@RyanM I'd represent time as it is. That's independent of displaying it, obviously :)
 
What do you mean "as it is"?
But yeah ignore the problem of displaying it
Just the data model
 
7:55 AM
@RyanM Obviously like this:
 
@VLAZ the hissing is accurate
 
@RyanM That's my way of avoiding the fight of picking the representation. But anything that's epoch is fine with me :) Then anyone can have it the way they want it down the line :)
 
@Scratte That's a reasonable thing to do (made the same mistake myself) but not quite correct. Books don't generally have a release time, so you risk the wrong date being shown in some time zones.
But that's not the worst part: with older books, you might only know the month, or even the year.
So you really want a date format, not a time format, and likely split into a mandatory year, with an optional month and date.
 
Also, for books, movies, etc media, they might have multiple publishing dates.
First, second, third edition. Or release date in the USA, in Germany, in France, etc.
 
Also, if you do make the mistake of using an epoch-based timestamp, make sure it's 64-bit, not 32-bit.
Turns out they've had books for a few centuries now and you'll need large negative numbers.
 
8:03 AM
@RyanM How can I risk the date being wrong with epoch? It's all about handling the epoch, not about storing it, no?
 
@VLAZ The editions, at least, are generally logically different books. And I'm content to say whenever an edition was first released, that's the release date ;-)
But you're right, it could be more right.
 
@Scratte Epoch tracks an exact time down to the second. However, a book might have been released "in May 1763". Or even "in 1810".
 
@VLAZ Fair enough. I'm thinking the question wasn't detailed enough :)
 
@Scratte Suppose the book was released Jan 12. There's no way to encode Jan 12 as an epoch-based timestamp that is Jan 12 in every time zone (you could, of course, have a convention that it's always read as UTC or something, but then...just use a date format).
 
"Needs details or clarity"
 
8:06 AM
@Scratte I quote: "(this is absolutely a trick question)"
 
"Needs trick debugging details"
 
How would you want to store birthdays? ...and when an answer comes in "But remember we do not have exact time for when people were born in 400 BC"! :P "Sometimes we only know the century"
 
Uh...speaking of that.
I know that there are people alive today that don't know their exact birthday.
 
@Scratte Right, so that would be an important consideration for that data model
 
They were born in a remote village and a 2-3 months later or so, they were registered.
 
8:07 AM
My point was the the requirement changed :)
 
No, you (and I, when I did this) failed to discover the subtleties of the requirement :-)
 
@VLAZ I know one person that doesn't know which date they were born.
 
this was basically the information I got when solving the problem of encoding release dates, and I did in fact make the same mistake.
But the requirement was always there, I just didn't know
 
@RyanM Normally that's something I'd figure out when asking about all the details :)
Right. So you made the same assumption and fixed it when you came to know that it was better to handle year / month instead :)
 
Well...we never actually did fix that.
 
8:10 AM
But it begs more questions because a book can be released on different months in different countries.
 
Because it would've been a non-trivial amount of work for very little gain, even though our backend actually did handle this correctly.
My original point was "Dealing with dates in programming is the worst," and I stand by that, with this as an example :-)
 
The thing I like about epoch is that you can just choose to discard the time information.
And you can also just say that all time is in CET. And have the date-edge sorted right there.
Then later on when you add publishing times of e-books, you can get it down to the second, which is probably going to be needed.
 
@Scratte We had a wonderful bug where content was expiring a day before it was being displayed as expiring, caused by doing almost exactly this.
 
If you "calculate" the CET time before you enter it, then this bug should not be there :)
I mean epoch is epoch.. not that it's going to change by timezone at all :)
 
whyyyyy would you use CET
 
8:14 AM
CET as in Central European Time?
 
or any standardized time zone other than UTC, really
 
It doesn't matter which. UTC is fine too. Probably better because there's no pesky summer time. My point was just to make it uniform everywhere, so you don't get local date and time information :)
 
see also Google Standard Time (e.g., stackoverflow.com/a/36301559/208273)
 
@VLAZ Yes :)
 
(somewhat relatedly, you have no idea how many people I've had to correct when they asked what time zone a timestamp was encoded in, or how to convert a timestamp between time zones...)
 
8:17 AM
But I was trying to make a point that just storing year and month is probably going to be insufficient in the near future :)
@RyanM Ahh.. I can imagine :) But, that people get confused in no excuse for not using epoch :D
 
(Well, year/month/day, but...) Yeah, potentially. On the other hand, I don't imagine most humans caring what time of day a book was released.
 
I can! Especially with competing authors :)
 
You'd only need that sort of precision for a timed release, and tying that to the release date would be a mistake (what if you don't get in on release day?)
True, I suppose if you're building a reference database it could be important.
 
I see the point of that not being relevant for say.. the bible. But for a new e-book, it could be important. The requirement is like a god-requirement, if you want to account for everything :)
But you could just have both an epoch and a year / month / day.. and then account for all kinds of scenarios.
 
don't even get started on bibles from a database reference perspective. there are entire apps dedicated to just bibles.
they are quite feature-rich
 
8:23 AM
Heh.. there is no one release date? :D
 
There are dozens of versions
 
@RyanM Seems too few. I'd expect hundreds.
 
Actually I have this on my voting log. If there's no second, then it's because that was lost. If there's no minute.. and it there's no hour.. :)
 
Could be.
 
Not just hundreds. People still make new ones.
There's in every language and several different interpretations. There's children variations and cartoons. Not sure if there are horror versions :P
 
8:25 AM
There is always somebody who is more familiar with the word of God...
I think there was a manga version, too.
 
I remember that many of the top apps in the Books & Reference category were bible apps
 
Some people made a lot of money on religion..
 
These were the top free apps, but they may have had ads; I'm not sure
 
Also helps that the bible is free to use. If you want to make an example app, it's a good one to pick up and get to grips with the API you are going to use and such, instead of logic.
 
Then again, all the apps I've worked on professionally were "free" too, and yet for profit
@VLAZ It also helps that it's a limited corpus, so you can implement a lot of features more easily than if it needs to work on the corpus of "whatever ebooks publishers give us"
 
8:30 AM
Sometimes I feel like I'm the only one making free apps not for profit :D Obviously that's not even close to true :)
 
I'm currently doing open-source library development
for apps
...still for profit, though.
 
@Scratte You're not. I had a colleague who made some apps for completely free.
 
Just very indirect profit.
 
Well, lots of completely free stuff made people very rich :)
 
He said it's just not worth adding ads. It would drive away some people and he just wanted to make some small games people enjoy.
He also then went to do app development as that was his passion. So...I guess it did indirectly help him.
 
8:32 AM
Yes, people notice when stuff is nice :) I'm sure Linus isn't exactly a poor man :)
 
BTW, I had an interview with a company that published games on the google app store. They apparently have a whole data analytics department that tracks all sort of user behaviour metrics and come up with solutions for when is the best time to offer the user to pay something, in order to maximise the chance they say yes.
I didn't get the job but also, I don't think I would have taken it. It just sounded scummy.
 
It is.. it's about manipulating people.
 
And here I just made our app stop asking people to rate it right after it crashed...
 
LOL!.. Good one.. :)
 
That was a hilarious bug, because one of the rules for when it would ask involved app launches...so users would often hit the criteria right after relaunching the app post-crash.
Whoops.
 
8:38 AM
BSOD -> "How would you rate Windows?"
 
Sometimes the "Please rate this app" is just annoying though and will effect the rating on its own..
@VLAZ Yo! You lost all my work because I don't backup :( But you picked a nice blue.
 
user image
2
 
I remember seeing that before. It's priceless :)
 
@Scratte well the goal is not to ask people who'd give you a negative rating for that :-)
 
But how can you know? :)
 
8:42 AM
Very simple - only ask for rating after the user wins 1 million dollars
 
@VLAZ is figuring out the right time to ask someone to pay for something that different than other conversion optimization A/B testing?
 
The thing about all this calculating time and whom to ask is that it makes the result distrustful.
 
I think the scumminess is more a factor of usage of manipulative tactics like trying to guilt you, mess with your emotions, appeal to people with bad habits...
 
@RyanM dunno. I was just told they had data scientists on the case that build models or whatever using a whole slew of metrics. My job would have just been to implement the models that the data scientists came up with.
 
So when we see 99% of our customers are completely satisfied, I think "Yes.. those are the ones that are still your customers, and they only account for 0.01% of all the people that tried your product."
 
8:45 AM
 
 
8 hours later…
4:15 PM
@Scratte I've done this before on a private team actually, then accepted all the flags:
 

« first day (2111 days earlier)      last day (990 days later) »