Time handling and user experience, Backup Scheduling in RavenDB as a case study
Time handling in software sucks. In one of the RavenDB conferences a few years ago we had a fantastic talk for over an hour that talked about just that. It sucks because what a computer think about as time and what we think about as time are two very different things. This usually applies to applications, since that is where you are typically working with dates & times in front of the users, but we had an interesting case with backups scheduling inside RavenDB.
RavenDB allow you to schedule full and incremental backups and it used the CRON format to set things up. This make things very easy to setup and is highly configurable.
It is also very confusing. Consider the following initial user interface:
It’s functional, does exactly what it needs to do and allow the administrator complete freedom. It is also pretty much opaque, requiring the admin to either know the CRON format by heart (possible, but not something that we want to rely on) or find a webpage that would translate that.
The next thing we did was to avoid the extra step and let you know explicitly what this definition meant.
This is much better, but we can still do better. Instead of just an abstract description, let us let the user know when the next backup is going to happen. If you run backups each Friday, you probably want to change that to the before or after Black Friday, for example. So date & time matter.
This lead us to the next issue, what time? In particular, backups are done on the server’s local time, on the assumption that most of the time this is what the administrator will expects. This make it easier to do things like schedule backup to happen in the off hours. We thought about doing that always in UTC, but this would require you to always do date math in your head.
That does lead to the issue of what to do when the admin’s clock and the server clock are out of sync? This is how this will look like in that case.
We let the user know that the backup will run in the local server time and when that will happen in the user’s time.
We also provide on the fly translation from CRON format to a human readable form.
And finally, to make sure that we cover all the basis, in addition to giving you the time specification, the server time and local time, we also give you the time duration to the next backup.
I think that this covers up pretty much every scenario that I can think of.
Except getting the administrator to do practice restores to ensure that they are familiar with how to do this.
Update: Here is how the field looks like when empty: