Live data from Hacker News

Double Entry Accounting for Developers

django-hordak.readthedocs.io

191–200 of 237 posts

Re: Double Entry Accounting for Developers

#191
post #186
post #179

Earlier quoted context omitted.

This has been an interesting conversation with several people. I am really surprised how much negative numbers are confusing or interpreted as my idiosyncrasy. > I’ve seen financial accounts quite more complex than two lines Definitely. For hundreds of years the convention has been columns. Credit values in the right-hand column, debit values in a left-hand column. The column is the label of which type of money it is…

I have no problem with negative numbers. But most people would find your idea of using negative numbers for assets rather idiosyncratic. It's more natural to say that the assets of Goldman Sachs are $1trn than to say that they are -$1trn, for example.

It's definitely not my idea! It wasn't Goldman Sachs, but I did a consultancy 15 Years ago for a large bank (my little job was a long way from programming the core, but used it extensively). Their system stored debit as negative numbers. That's when I learned it and had the aha moment when everything instantly simplified. Since then all the accounting software I've seen the inside of do.

Most lay-people find double entry in accounting idiosyncratic. It has this bad reputation for being full of special case rules.

It is interesting that the one comment I got from an accountant on here it seemed fine with debit as negative numbers.

Goldman Sachs absolutely know that they have DB$1tn! Anyone who thinks it is either a credit account or just a bare number is not going to be dealing with that!

Thanks for carrying on the chat.

Re: Double Entry Accounting for Developers

#192
post #191
post #186

Earlier quoted context omitted.

I have no problem with negative numbers. But most people would find your idea of using negative numbers for assets rather idiosyncratic. It's more natural to say that the assets of Goldman Sachs are $1trn than to say that they are -$1trn, for example.

It's definitely not my idea! It wasn't Goldman Sachs, but I did a consultancy 15 Years ago for a large bank (my little job was a long way from programming the core, but used it extensively). Their system stored debit as negative numbers. That's when I learned it and had the aha moment when everything instantly simplified. Since then all the accounting software I've seen the inside of do. Most lay-people find double e…

> It stored debit as negative numbers.

Did it display assets in the balance sheet as negative numbers?

> the one comment I got from an accountant on here it seemed fine with debit as negative numbers

Was that accountant fine with assets as negative numbers?

> Goldman Sachs absolutely know that they have DB$1tn!

The did have $1tn in their balance sheet. No DB, no CR. Just $1tn.

Re: Double Entry Accounting for Developers

#193
post #171

Earlier quoted context omitted.

Equity is similar to a liability. Ít is owed to the owners of the entity. Making assets positive in code is conventional.

> Equity is similar to a liability. Ít is owed to the owners of the entity. You can kind of see the easy rationale there. I'm not sure it's very deep though. Revenue is in the same group (Credit). And the assets are like expenses (Debit). That is a bit more of a just-so-story in my mind. > Making assets positive in code is conventional. Are you sure? What code are you talking about? Making everything positive in the…

For one example, read the docs for Beancount, which is mentioned above.

Signed values are the way to go!

Re: Double Entry Accounting for Developers

#194
post #149

Earlier quoted context omitted.

If your banana is for consumption and you pay cash: Then debit Food Expenses (decrease equity) and credit Cash (decrease assets). Accounting equation is balanced. If your banana is for resale and you pay cash: Credit Cash (decrease assets) and Debit Trading Stock (increase assets). Accounting equation is balanced. If your banana is for consumption and you buy it on credit from your supplier: Credit Loan account (incr…

I'm glad you guys understand it in South Africa, and if I ever wanna open an accounting start-up, I'll be sure to source talent from there, but you lost me: > Then debit Food Expenses (decrease equity) and credit Cash (decrease assets) Why are you decreasing the number in two columns? I don't really need to know personally, but I hope this gives you an idea of what kind of things confuses people. I don't think the ba…

> Why are you decreasing the number in two columns?

It's not two columns, it's both sides of the equation:

Assets = Equity + Liabilities

So if you're decreasing equity, but not gaining any liability, then the only option is to decrease assets to be balanced.

Re: Double Entry Accounting for Developers

#195

I think I understand the mechanics of double entry bookkeeping, but what I find confusing about it is that it is the redundancy. People emphasize the error detection, but these errors can only exist in the first place because of the requirement to record each transaction twice. Also you get a lot of "fictious" or virtual accounts that don't correspond to concrete piles of cash or bank accounts. It seems much easier t…

I agree, I don't understand how creating two entries in two separate locations is a good thing. You have to constantly monitor that you have matching entries everywhere. No thanks.

Instead, have a master list of transactions with money in/out in each transaction. As long as every transaction balances, you are golden.

Balances, history, cash flow, etc. can all be figured out from this one central location.

This is how ledger-cli works.

Re: Double Entry Accounting for Developers

#196

From the site: "I found the core explanation of double entry accounting to be confusing. After some time I distilled it down to the following: "Debits decrease the value of an account. Always. [1] Credits increase the value of an account. Always. [1] "[1] (1, 2) This is absolutely not what accountancy teaches. You’ll quickly see that there is a lot of wrangling over what account types get increased/decreased with a d…

The traditional accounting identity is something like "Assets = Liabilities + Equity", or in an expanded form "Assets = Liabilities + Contributed Capital + Revenue - Expenses - Dividends" (from Wikipedia https://en.wikipedia.org/wiki/Accounting_equation). You can re-arrange that as:

Assets + Expenses + Dividends = Liabilities + Contributed Capital + Revenue

Traditional accounting takes this as says: "All accounts have positive values. All transactions contain an equal number of debits and credits. Debits always come first, are always written on the left, and so it (sort of) makes sense for debits of left hand side accounts to always increase the value of the account, while debits of right hand side accounts always decrease the value in the account. Similarly, credits come second, are always written on the right, credits of right hand side accounts increase the value of the account, and credits of left hand side accounts decrease the value of the accounts."

It turns out if you work through the implications of this, it works perfectly. I buy lunch for $5, so I must have a $5 debit and a $5 credit. That's an expense; my expenses are going up, expenses are on the left, so they go up via a debit. The matching credit could be to cash; cash is an asset, it's also on the left, credits make left hand accounts go down, that makes sense. Or the matching credit could be an accounts payable account, that's on the right hand side, and credits make right hand accounts go up, which again makes sense.

The core logic here is that changes must balance. If your changes are both on one side, one will be positive and one will be negative (summing to 0). If your changes are on opposite sides, either both will be positive or both will be negative (still summing to zero).

But, you could also re-arrange the equation further:

Liabilities + Contributed Capital + Revenue - Assets - Expenses - Dividends = 0

Algebraically, that's the same. If you built a system on that, you could say something like "All transactions must sum to zero. Asset, expense, and dividend accounts are subtracted from the balance, while other accounts are added to it." That still works. My $5 lunch increases expenses, which is a "negative type" account, so I have to either increase a matching "positive type" account (like liabilities) or decrease a matching "negative type" account (like assets) so everything stays zero. It doesn't feel...easier, but it works.

Or you could take it a step further, and weirder, and say:

Assets + Expenses + Dividends + Liabilities + Contributed Capital + Revenue = 0

That...uh....doesn't work mathematically, unless you flip the sign of all assets, expenses, and liabilities. So maybe:

(-Assets) + (-Expenses) + (-Dividends) + Liabilities + Contributed Capital + Revenue = 0

I dunno, this is getting a bit weird. Now my $5 lunch is a $5 credit and a $5 debit. Expenses has gone up, so that must be what the author calls a credit, but since expenses is a magic negative account the displayed value will go down. And then we must have a match debit (in the authors terms) which will make an account go down. And again, we can pick assets to go down (if I spent cash), except again assets is a magic flipped account so will make the displayed value of assets increase, or we could pick liabilities which is a normal account and thus the value will actually go down.

Technically, all this is interchangeable. However: The standard form (LHS = RHS, debits increase LHS and decrease RHS, credits increase RHS and decrease LHS, debits = credits) is universally used around the globe, and has been in active use since the middle ages. It's also, in my view, relatively intuitive once explained. The middle form (all accounts sum to zero) is unorthodox, but also fine. Both require to to know an equality, and ensure that each transaction respects the equality.

The linked form is, in my view, by far the least intuitive, and also re-uses accounting terms with a different meaning. Not only does it not, in my view, help novices understand accounting, but I fear learning it makes it actively harder because you'll need to unlearn it first.

But it does, technically, work.

Re: Double Entry Accounting for Developers

#197
post #192
post #191

Earlier quoted context omitted.

It's definitely not my idea! It wasn't Goldman Sachs, but I did a consultancy 15 Years ago for a large bank (my little job was a long way from programming the core, but used it extensively). Their system stored debit as negative numbers. That's when I learned it and had the aha moment when everything instantly simplified. Since then all the accounting software I've seen the inside of do. Most lay-people find double e…

> It stored debit as negative numbers. Did it display assets in the balance sheet as negative numbers? > the one comment I got from an accountant on here it seemed fine with debit as negative numbers Was that accountant fine with assets as negative numbers? > Goldman Sachs absolutely know that they have DB$1tn! The did have $1tn in their balance sheet. No DB, no CR. Just $1tn.

> Did it displayed assets

It's an API. There are many tools built on top of it, many with UIs. I'm sure they display things in many different ways for people internally and externally. The system I was working was back-end. It used negative numbers for debits. And it was really important you didn't confuse credit and debit numbers.

> Was that accountant fine with assets as negative numbers?

I find it hard to believe they didn't understand that's what Using negative numbers for debits means. They would be pretty aware that assets are debit accounts.

> The did have $1tn in their balance sheet. No DB, no CR. Just $1tn.

Did they have a complex balance sheet (I.e. beyond that just a couple of lines summary) with no columns? How do they represent a balance if you couldn't tell which were credits and debits?

Re: Double Entry Accounting for Developers

#198

Earlier quoted context omitted.

It's wrong in the sense that anyone who's studied standard accounting will look at your books and consider them to be incorrect. This is important if you want to share your books or reports with your local tax office, who will begin investigating you for committing tax fraud. It's the same reason why no one fixes the HTTP "Referer" header typo. You can, but if you do then you'll have difficulty communicating with the…

> look at your books I think OP is encoding the sign-reversal internally though, right? It "displays" the two incorrectly classified account types exactly per the standard convention instead of re-applying the convention at every operation. All reports would follow the 'Classic' conventions. At least that was my reading!

It doesn't, the Equity account displays a negative number if the company is in the green (it decreases when you emit stocks), the Expense account displays positive numbers (it increases when you spend money), the Income account displays negative numbers (it decreases when you earn money).

In beancount, the accounting equation is Expense+Income+Equity=0 and all signs are always left intact (there is only addition).

So you start a company with a seed capital of $5. You borrow $5 to the bank, buy an expensive apple for $10, sell it for $15 and give the money back to the bank with an interest of $1, then close the exercise and carry the profits (don't distribute dividends). Your ledger is:

  Initial capital
    Assets:Cash +5 USD
    Equity:Seed -5 USD
  
  Borrow to the bank
    Assets:Cash +5 USD
    Liabilities:Bank -5 USD
  
  Buy an apple
    Assets:Apples +10 USD
    Assets:Cash -10 USD
  
  Sell the apple
    Income:Sales -5 USD
    Assets:Apples -10 USD
    Assets:Cash +15 USD
  
  Reimburse the bank
    Liabilities:Bank +5 USD
    Expenses:Interest +1 USD
    Assets:Cash -6 USD
  
  Close the exercise # beancount does that for you for any time period btw
    Expenses:Interest -1 USD
    Income:Sales +5 USD
    Equity:PreviousProfit +4 USD
Notice how every transaction balances to 0 just by summing it, no need to remember anything.

Now, you're at the beginning of the next exercise. To know your accounts you just compute a sum of every operation to it, again no special case. So your accounts are:

  Expenses 0 USD
  Income 0 USD # as expected at beginning of exercise
  Assets:Apples 0 USD
  Assets:Cash 9 USD
  Liabilities:Bank 0 USD
  Equity:Seed -5 USD
  Equity:PreviousProfits -4 USD
And yet again, the sum of all of that is 0.

Personally I like it, not having any special cases. Yes, it may confused an accountant (because they learned the special cases by heart ! Somebody coming with a fresh mind has no reason to be confused, it's all just conventions !) but it's simpler for me and just as consistent.

Re: Double Entry Accounting for Developers

#199
post #197
post #192

Earlier quoted context omitted.

> It stored debit as negative numbers. Did it display assets in the balance sheet as negative numbers? > the one comment I got from an accountant on here it seemed fine with debit as negative numbers Was that accountant fine with assets as negative numbers? > Goldman Sachs absolutely know that they have DB$1tn! The did have $1tn in their balance sheet. No DB, no CR. Just $1tn.

> Did it displayed assets It's an API. There are many tools built on top of it, many with UIs. I'm sure they display things in many different ways for people internally and externally. The system I was working was back-end. It used negative numbers for debits. And it was really important you didn't confuse credit and debit numbers. > Was that accountant fine with assets as negative numbers? I find it hard to believe…

For the record, this is what the consolidated balance sheet looks like: https://imgur.com/a/i8q0Fa2

Re: Double Entry Accounting for Developers

#200

From the site: "I found the core explanation of double entry accounting to be confusing. After some time I distilled it down to the following: "Debits decrease the value of an account. Always. [1] Credits increase the value of an account. Always. [1] "[1] (1, 2) This is absolutely not what accountancy teaches. You’ll quickly see that there is a lot of wrangling over what account types get increased/decreased with a d…

Spot on. This is another situation of trying to solve a problem that doesn't exist and the writer does not understand at all. There are reasons why GAAP and IFRS exist. Accounting can make a lot of sense to a programmer, I've moved between fields early on with relative ease because accounting is extremely rule based/puzzle-oriented and adheres to a structured and specific framework. I haven't touched accounting in years (though I do have a bachelors in accounting) but this is jarring and would not recommend this to anyone.
Post reply on HN