> But in all of the sane systems I know, at the end of the day it’s really all “when”.
Aren't databases basically "where"?
Only if your logic is all stored procedures. It doesn’t matter what the database says if you mangle the read operation.
Re:Immutability is not enough (2016)
by hypertele-Xii on Saturday June 26, 2021 @04:36PM
(#27645597)
What if the database itself contained all business logic? (but no plumbing)
Every table has a function that is the only function that can write/insert into that table. The functions themselves are just records in a specific table, which the database schedules to run based on global access activity (it prefers to prioritize functions that consume more records than they produce, to keep space tight).
If there is no “where” for state alterations and they can happen any time, then you are in full global shared stage anarchy mode, which some people seem to be perfectly fine with.
If the system of record is the source of authority then “when” is at write time, regardless of who does the write.
If you know when the data was last altered, you can reason about every interaction that happens “after” because what you see is what you get.
The smartest thing about Angular was that there was a layer of the code - the services - that was expected to do all state transformations on data from the server. Anything in your app was “after” so you could trace the interactions by reading the code.
Plus, it was easier to convince the REST endpoint to do the tranforms for you because you had a contiguous block of working code that explained the difference between what you got and what you wanted. A few sniffs at the data to determine if the modifications had already been made was all the migration strategy you needed. If the transform was cacheable upstream, or found its way into the database, the more’s the better.
The upshot is that if you don’t know a priori what information a unit of work requires, then you don’t have an information architecture. And if you don’t solve that problem then you’re going to fall into a concurrency tarpit that often gets called Cache Invalidation Hell, but that’s just the dominant symptom.