4 ms·
I built a double-entry ledger for multiple different kinds of credit cards at redcarpetup. the way i like to primarily think of it technically is idempotency. T
by sandGorgon 3y ago
I built a double-entry ledger for multiple different kinds of credit cards at redcarpetup.
the way i like to primarily think of it technically is idempotency. Thinking of balances is the wrong way to model it :
1. since you want the capability to recompute all balances using ledger entries.
2. there are not two balances. There's usually a lot more. you want to update reward points, dues, late fees, partner share, etc etc etc. a 2 balance double entry ledger is a simplification.
once you set your mental model to think of it as a idempotency problem, there are multiple ways to model it. For e.g. a directed graph - traverse the entire subgraph to update balances.
Or model it as a log database and re-run txns to arrive at balance computation.