Discussion about this post

User's avatar
Ron Lobo's avatar

Interesting read, thanks for sharing!

Totally agree with the timestamps, daylight saving bugs are super annoying. I remember we stored date and time just as datetime in the local timezone (pacific time) and had to run a script to convert 2 times a year when it was daylight savings - ugh

For currencies amounts, always store as integer or big integer in the micros (see forex notations) to avoid rounding errors altogether.

Use an event store for immutability (timescale DB for example), blockchain is usually unnecessary unless it's an untrusted entity, it's ok to be public to everyone and you are fine increasing your storage cost by 1000x :D

Another recommendation for systems like that is to thoroughly test everything with automated tests, 80% test coverage won't do it here, aim for almost 100% and cover all happy, error and edge cases as much as possible.

Expand full comment
Magnus Petersen-Paaske's avatar

The timestamps one is interesting. Even if the UTC integer is the canonical representation of a time I think it still makes sense to record the timezone for the user/operation and what was shown on the users screen. There are all kinds of situations where someone auditing the books will want to know the local time and not just the time – for instance if a tax changes at midnight but you have multiple timezones to consider or if you want a month/quarter/year view of the data.

Can be represented as a tuple (UTC timestamp, timezone name, ISO-8601 representation in local time)

Expand full comment
14 more comments...

No posts