3 ms·
This blog entry taught me a mathy way of understanding double-entry accounting: https://martin.kleppmann.com/2011/03/07/accounting-for-computer-scientists.html
by haberman 5y ago
This blog entry taught me a mathy way of understanding double-entry accounting: https://martin.kleppmann.com/2011/03/07/accounting-for-computer-scientists.html https://martin.kleppmann.com/2011/03/07/accounting-for-compu...
Summarized: a ledger is a directed graph of accounts, where edges are transactions, and each transaction is recorded twice: in the "from" node and the "to" node.
- rahimnathwani 5y agoThe article is mostly correct[0], and is very good if the explanation clicks for you. I suspect some people (even some HN readers) would find it easier to think of ledgers as lists of transactions with running totals. [0] e.g. it's not strictly true that book value is a lower bound on company value
- wutangson1 5y agoBut “a ledger” is not a directed graph of accounts, is it? There is no ‘from - to’ in a ledger. A ledger simply reorganizes the transactions from chronological order (aka journal entries) into subject/account headings. Not the same, but similar to clicking ‘subject’ column tab on your email client to reorganize your emails from descending date to subject attribute.
- rahimnathwani 5y agoThat explanation didn't click with me, either. But I guess you could model each transaction as an edge, with the direction specifying which account is debited and which credited, and the weight determining the amount. I don't find that particularly helpful myself, but I put that down to my unfamiliarity with graph data structures and the associated algorithms. Maybe there's something you can do more easily with a graph database, than you can if you have the same info in a table?
- wutangson1 5y agoSure. Just like blockchain- or any other decentralized ledger- may be a tremendously disruptive technology for property recording, sale/transfer, and financing in the future (compared to the current archaic system of deeds/titles for real property or UCC financing recording for secured transactions); so to, a graph database may clearly illustrate the point of bookkeeping along with the share of assets creditors and investors are entitled to realtime.
- lazyasciiart 5y agoI found it an interesting and useful explanation, but the bit in the middle where he just says "now categorize each node, I colored them in!" is the bit I always had more trouble with, so I was disappointed to see basically the same explanation as I've heard before.
- rahimnathwani 5y agoPerhaps my explanation will help? In your chart of accounts, each account corresponds to exactly one of these: - Asset - Liability - Equity (changes in this affect the income statement) Whenever a transaction takes place, the debits and credits must sum up. For example, when you take a bank loan, your assets increase (debit) but your liabilities also increase (credit) by the same amount. Sometimes something touches more than two accounts. For example, if you sell a cup of coffee for $2, using up $0.50 worth of beans: CR Revenue $2 DR COGS $0.50 DR Cash $2 CR Materials $0.50 The first two lines increase the book value of the business by $1.50. The last two lines increase the assets of the business by $1.50 (cash up by $2, bean inventory down by $0.50). It's easy to get confused about debits and credits. I attempted to create a memorable explanation here: https://www.encona.com/posts/debits-and-credits https://www.encona.com/posts/debits-and-credits