Live data from Hacker News

Double-entry bookkeeping as a directed graph

matheusportela.com

311–320 of 388 posts

Re: Double-entry bookkeeping as a directed graph

#311

Earlier quoted context omitted.

> If you withdraw money from the ATM, you debit your bank account and credit your cash account You have that exactly backwards! Assets (like bank accounts and cash) are "debit accounts" meaning they increase with debits and decrease with credits. When you withdraw money from your bank account, the bank account goes down, so we know that must be a credit to the bank account, while the cash goes up, that is a debit to…

Do they have it backwards? It sounds like a valid perspective to me. I take money from an ATM: the number in my current account decreases, the cash I have on hand increases. Nothing wrong there. Sure the banks perspective is different but maybe I'm not interested in that. I love that this thread is full of people confidentally saying something that sounds correct or at least reasonable and the first reply that comes…

> accounting a solved problem but apparently not.

well, it is if you do it on books, not in natural language.

since it looks deceptively simple everyone throws around sentences that are screaming for mandatory context.

the whole GAAP (generally accepted accounting principles) (and certs like CFA too) are about codifying this context.

what goes where is the name of the game. can you consider this or that an asset or not? is that an expense or you got credit from your vendor, because they shipped it before you paid it? which quarter does it belong to if they shipped it before new year's eve but we only pay it next financial year? etc... etc...

that said accounting is not a mechanical system. there are quite a lot of degrees of freedom ... but there are of course clearly wrong ways to do it ( https://en.wikipedia.org/wiki/Creative_accounting )

oh, and when someone says debit/credit just use a spray bottle on them and ask them to simply state clearly what happens with the fucking number on which of your accounts, does it increase or decrease. (ie. they should just say that the money goes from this account to that account, and suddenly there's no ambiguity.)

Re: Double-entry bookkeeping as a directed graph

#312
post #150

Earlier quoted context omitted.

> So many graphs with the independent variable on the Y axis I was perplexed by this as well and none of my profs could cogently explain it. The classic example are supply and demand curves, with price as the Y axis. I finally realized they are actually trying to communicate that price is not under the control of the buyer or seller, but that the market dictates the price given a level of production. This kind of “sp…

Indeed, one of the main problems with econ education is that at the most basic level they teach a model for the "spherical cow" free-market. Which is all that most people end up learning. And then those people try to apply this reasoning to real world markets - the vast majority of which do not satisfy the assumptions of the free-market model. So almost all public discussions of micro-economics is totally useless.

... microeconomics works amazingly well!

scroll down and look at that graph! https://www.fda.gov/about-fda/center-drug-evaluation-and-res...

also go to and read about the studies https://www.noahpinion.blog/i/142905737/the-evidence-is-in-f... and you can see the exact numbers from the datasets, these are all spherical cow parameters basically!

Re: Double-entry bookkeeping as a directed graph

#313

I see a lot of consternation about credits and debits and the nomenclature. Something that makes this simpler to think about from a modern perspective is that accounting is older than the popular use of negative numbers. By a lot. If we were to invent accounting today, we'd probably use positive and negative accounts instead of debit and credit accounts. Algebra over addition is second nature to us at this point, but…

I don't think it really helps to use negative numbers (e.g. thinking of income as negative is very confusing). I started a discussion [1] on the PTA subreddit about a month ago about how to make PTA syntax more intuitive, and someone suggested using arrows to mark the "from" (aka credit, or negative) and "to" (aka debit, or positive) accounts. The numbers are unsigned and the terms "credit" and "debit" aren't used, and I think it's way more intuitive.

[1]: https://www.reddit.com/r/plaintextaccounting/comments/1bh3x7...

Re: Double-entry bookkeeping as a directed graph

#314
post #205

Earlier quoted context omitted.

Depreciation isn't relevant here, again, you're confused in the types of assets, not all of them are depreciated, only some with some specific properties like time of expected user. Just read the definition of assets in any (accounting) dictionary, or try to record your snack purchase in real accounts and see which side of the balance sheet this account end up in (hint: inventories, assets).

The person you're replying to is confused, but that's because accounting can be confusing. An account is fundamentally either an asset or a liability. When you buy something with a credit card, you've incurred a liability, and gained an asset, no matter what you've purchased. If you use a debit card or cash, you're trading one asset for another. One of the basic asset categories is expenses. That's the confusing part…

These are the sorts of comments that make accounting and bookkeeping more difficult for people who are learning it. It helps no-one to try to think of income and expenses as equivalent to liabilites and credits. They are merely on the same sides of the accounting equation.

Assets + Expenses = Liabilities + Equity + Income

Expenses are not assets. For example, depreciation is not an asset. It is the representation of the life of the asset getting used up. It is an expense, a pure expense. Interest paid on a debt is not an asset. It is a pure expense. There are no word games that turn these into assets, like you might have for a software subscription or a gas bill.

Expenses diminish the business. Unlike assets, they do not represent anything that can be liquidated. Income increases the business. Unlike a liability, it does not represent a claim against the business.

Why aren't expenses and income on the balance sheet? Because they are netted out into retained earnings for the period. Imagine a business that cannot have a liability. Its accounting equation would simplify to:

Assets = Equity.

Income increases equity, expenses decrease it. Is equity a liability? NO. It is a separate account category with a credit balance. Want to look silly? Do as I did when I was a young programmer who knew everything and confuse the two.

People not learning bookkeeping before writing accounting software (which is a lot more software than people expect) make many dumb errors that frustrate users, bookkeepers and accountants. A decent bookkeeping book (e.g. Bookkeeping for Dummies) goes a long way to familiarizing someone with how to handle double entry accounting.

Re: Double-entry bookkeeping as a directed graph

#315

Earlier quoted context omitted.

They're pretty fast, but if everyone writes software that does 10,000x more computation than necessary on that basis, suddenly they're slow.

“If everyone is incompetent, all software will be bad”. Got it, thanks.

You were the one advocating for incompetence.

Re: Double-entry bookkeeping as a directed graph

#316
Double-entry bookkeeping is inferior to N-entry bookkeeping, whereby a transaction generates N entries, that sum to zero. Multiple dual-entry transactions are needed to record a single N-entry transaction which is clumsy and harder to follow.

Also, by the way, the whole debit/credit thing in English-language accounting is supremely idiotic: a credit is an increse in this account, but a decrease in this other type of account? What? It's purely for job security for accountants.

There are accounts which represent outside interests/stakes in the company. Then there are accounts which represent what the company has.

The outside interest accounts run negative (under normal conditions). An interpretation of that is that the company owes what it has to the outside interests.

The sum of all the accounts is zero.

The outside interest accounts go negative when the company grows. E.g. $100 added to cash (account representing what the company has) might be balanced by a -$100 into the owner's equity account. The company owes $100 more to the owner.

If the $100 came from a bank, then rather than the equity account going down by $100, the account representing that bank or loan (outside interest) would go down by $100, more negative.

If the company buys some equipment for $100 for cash, then -$100 goes into cash, and $100 into assets.

When that asset depreciates, turning to $80 dollars a year later, -$20 goes into assets, and $20 into owner's equity, bringing it closer to zero.

Re: Double-entry bookkeeping as a directed graph

#317
post #249
post #103

Earlier quoted context omitted.

> Where it can become confusing is when money leaves you or comes in from an external source. There are still two entries, but one entry is in one party's books and the other entry is the other's. For example, I get a paycheque and I enter my income in a little book with green paper and DB/CR columns. At the same time, my employer has entered an expense in their book. Double entries. NO. I mean your employer probably…

Well, if I have a local entry ACME, inc Employment Income $100 DEBIT in my employment income account that money has not come out of thin air. Remember, money can not be created nor destroyed in this system. Somewhere there is a matching entry something like bregma, services rendered $100 CREDIT in my employer's books. And that money, in turn, was probably moved in from some other account internally. Mean time the onl…

I agree generally speaking, but what does that have to do with your local books? Nothing.

You almost certainly don't have access to your employer's books.

Also, the ledger entries for "bregma, services rendered" i.e. payroll will be much more complicated than that, there will be taxes, deductions, etc they have to account for as well.

Re: Double-entry bookkeeping as a directed graph

#318

Earlier quoted context omitted.

It sounds like your accounting instructor may have focused too much on implementation details (left/right), and too little on accounting principles. The terms debit and credit have meaning independent of their columnar position on a traditional ledger. I could create a ledger with the columns reverse or (shocking!) use a computer program with a data structure that doesn't encode the concept of left or right. I think…

The sheer amount of discussion this has created (both here and back in August, 2022, when you and I commented back and forth to each other in your link) validates my my instructor's philosophy to me. Concentrating on the accounts and the accounting equation, ignoring any "meaning" for the words debit and credit, results in the "right answer" without a lot of consternation.

I agree that the accounting equation is a good starting point. Without it there is no context for the individual accounts.

Over the ~20 years since I qualified as an accountant, I've found the concept of debits and credits useful. It has saved me from memorizing rules (like what's on the left and what's on the right), to design charts of accounts, to design rules for recording transactions etc.

Someone who doesn't ever need to design charts of accounts or accounting policies, and is never called upon to verify the correctness of an accounting approach, probably doesn't need to understand debits and credits. They can read a balance sheet and income statement without thinking about the concept.

And many people (even bookkeepers and accountants) are content to memorize rules without needing to understand their source.

But that doesn't mean the underlying concepts don't exist, or that they aren't valuable.

Imagine if there were a subreddit for accountants, some of whom dabbled in coding. There might be a back and forth about principles of objects oriented design. The general consensus might be that it's pointless to understand the principles, and that it would be better to focus on some small set of rules of thumb, that give the right answer in most cases.

They might be right in that context (accountants who code on the side), but it doesn't mean the principles don't exist or aren't valuable for people who do that stuff all the time.

(BTW I think accounting is, in general, taught very poorly. I wish more instructors used Frank Wood's books. An intuitive grasp of debits and credits is really useful and not hard to pick up, yet many people spend a semester studying accounting without developing any intuition at all.)

Re: Double-entry bookkeeping as a directed graph

#319
post #312

Earlier quoted context omitted.

Indeed, one of the main problems with econ education is that at the most basic level they teach a model for the "spherical cow" free-market. Which is all that most people end up learning. And then those people try to apply this reasoning to real world markets - the vast majority of which do not satisfy the assumptions of the free-market model. So almost all public discussions of micro-economics is totally useless.

... microeconomics works amazingly well! scroll down and look at that graph! https://www.fda.gov/about-fda/center-drug-evaluation-and-res... also go to and read about the studies https://www.noahpinion.blog/i/142905737/the-evidence-is-in-f... and you can see the exact numbers from the datasets, these are all spherical cow parameters basically!

I took both micro and macroeconomics in school. I had a similar thought, microeconomics is dealing with systems simple enough to be reasonably well modeled in mathematical terms. Macroeconomics seemed to be more about giving the rich cover when they screwed over the poor. Micro is a weird math class, Macro is a politics class.

Re: Double-entry bookkeeping as a directed graph

#320
I'm surprised that there are no mentions of a great hacker-friendly plain-text accounting software called `ledger` https://ledger-cli.org/ in this thread. It has amazing documentation when it comes to understanding basic principles of double-entry bookkeeping and goes through many typical situations and usecases. There are also several forks, most popular and advanced is `hledger` https://hledger.org/ (h is for Haskell), which provides some neat features out of the box, such as a simple web interface. All of them are very primitive compared to "professional" accounting software, but in return it offers great opportunities for hacking around while ensuring validity of your books.
Post reply on HN