3 ms·
When you need a single source of truth you cannot use optimistic UI. E.g. if the user is a realtor, then she can't tell the customer "you have now bought the h
by silvestrov 4y ago
When you need a single source of truth you cannot use optimistic UI.
E.g. if the user is a realtor, then she can't tell the customer "you have now bought the house" if there is no online connection and you're waiting for a sync. You can fill out and upload the form async, but commitment must be online.
You cannot tell the customer "you might have (or might not have) bought the house, we will only know later".
- BrentOzar 4y ago> You cannot tell the customer "you might have (or might not have) bought the house, we will only know later". Sure you can - in fact, that's what realtors call offers. You place an offer, and you only find out later if you bought the house, often days later.
- deleted 4y ago[deleted]
- couchand 4y agoTechnically correct, but you're missing the point. Eventually you do need to be able to commit some sort of transaction and get confirmation from the counterparty.
- ElevenLathe 4y agoThis is correct but you can do tricks to change who the counterparty is, which is often useful. If, instead of putting up a yard sign and saying "this house is for sale" and waiting for someone to come by and complete the transaction, the homeowners entered a contract with a brokerage to sell the house to anyone who is willing to abide by a list of terms (minimum price, occupancy date, etc.), then the brokerage can respond immediately and say "great, the house is yours". This is essentially the equivalent of sending a sell order to a stock broker.
- smac__ 4y agoIn this case the optimistic UI might be good to have a step like “this request is pending”. So when the form is submitted the data is ready to send and will send when it can. Ideally with an indicator that the user is offline and needs to be online to sync.
- thruflo 4y agoYou can if you acquire a distributed lock in advance, as per https://electric-sql.com/blog/2022/05/03/introducing-rich-crdts#reservations https://electric-sql.com/blog/2022/05/03/introducing-rich-cr...
- chefandy 4y agoThat's true even if you're example isn't perfect. Some types of transactions have business requirements that demand immediate consistency or responses. Contraindications certainly don't invalidate ideas, though. Use the right to for the job.