Live data from Hacker News

Double Entry Accounting for Developers

django-hordak.readthedocs.io

151–160 of 237 posts

Re: Double Entry Accounting for Developers

#151

Earlier quoted context omitted.

> What's wrong with fixing inconsistencies? In general, nothing. It's just not the software developer's job. If the accounting profession decided to change certain terms to fix inconsistencies, that would be fine.

I think that's missing the point of the original article. Of course you have to present a view of the accounts that is consistent with accounting rules and conventions. But that doesn't necessarily mean you have to adopt that external view as an internal model for any software you're writing.

At audit time the world of “holy shit what were these people thinking?” will be colossal, because we do not get to pretend that a system is a black box at audit time.

If those records don’t make sense to an accounting professional, then they’re fucked up, and that’s all she wrote. The world of audit has seen a million shysters try to falsify their books under the guise of alternative methods, and they are not interested in some self-serving hubris from programmers about re-inventing their own profession.

So this guide isn’t just philosophically off beam. It could get someone fired or sued.

Probably not prosecuted though. Probably.

Re: Double Entry Accounting for Developers

#152
I couldn't understand double entry accounting until I found out about ledger-cli / hledger.

These awful arbitrary "left-side / right-side" and "debit / credit" just doesn't make any sense.

As opposed to that, no-magic approach from ledger-cli where every entry must balance is intuitive to learn and mathematically correct. And it allows to go a bit beyond the whole "assets / liabilities / expenses / income" if needed.

Re: Double Entry Accounting for Developers

#153
post #131

Accountancy is(was?) widely taught in South African high schools. It was certainly quite common in the 1990s. I found it quite amusing when I realised that double-entry isn’t widely understood around the world, a realisation I came to after I first encountered one of many confusing “accounting for developers” posts on HN. It was quite easy for us 13 year olds to grasp: Assets=owners equity +liabilities (accounting eq…

The beauty of double entry is that if you have one entry you are sure of you can derive the rest. The way I think of it is that a cost is a debit. Everything else can be derived from this.

Buy an apple dr food expense cr bank. Buy an apple on credit dr food expense cr creditors. Pay that creditor dr creditors cr bank

What a good idea to teach it in school.

Disclosure: I'm a trained accountant, but this is just what works from me! Maybe because I started as a cost accountant. Lots of ledger clerks tell me that they start with the axiom that the bank is backwards, so you credit money out.

One other thing that helps some people is the convention of writing debits and credits in a single column, with credits as negative. Then the column must sum to zero. The balance on any account is just its sum. That might really help anyone thinking of storing transactions in a database... and you already know how to run a consistency check since the whole ledger always sums to zero.

Re: Double Entry Accounting for Developers

#154

Earlier quoted context omitted.

Also surprised by all these articles. But your point made me realise that most people didn't do accounting in high school like I did (also a South African). I wonder what some other uncommon high school curriculums from other parts of the world are. In retrospect I wish what we learnt in High School was more focussed on personal finance than essentially constantly doing double entry data capture.

I suspect accounting is a topic common in commonwealth countries curriculum (heh no pun intended) - Australia included it as well.

But the UK doesn't! That probably tells you something about the UKs relationship with the commonwealth.

Re: Double Entry Accounting for Developers

#155
post #22

Earlier quoted context omitted.

It is not incorrect. To make everything positive (and use the subtraction as you have) you need to have two different types of 'positivity' Credit and debit. And then you have to remember which things are subtracted and added so it gets back to balancing. That's why it gets so complicated. Money in your bank account is _negative_. It is a _debit_ in your accounts (this is not my invention this is true). Your bank acc…

Assets + Liabilities + Equity = 0 is incorrect. It's just simple basic maths formula, A = L + E so it's either 0 = L + E - A or A - L - E = 0, or A - L = E or A - E = L all stands true.

A=L+E

is true because L and E are Credit dollars and A is Debit dollars. And the total Debit is equal to the total Credit.

But instead of using debit and credit unsigned dollars, you can use negative numbers: Credit is Positive, Debit negative.

In that case

(-Assets) = Liabilities + Equity, so A+L+E=0

-Assets because you've made those debit dollars negative.

In fact you don't even have to remember which. Sum(Everything)=0. 'Balancing' means summing to 0.

The software I am aware of that does large-scale double entry calculations for large banks works this way (I did some consulting 15 years ago on data laundering for that system). And all those accounting rules about what accounts are debit or credit accounts, whether a credit increases the debit account, etc, it all isn't needed at a low-level. The confusing bits are only in the UI. Where a number stored as -10 is displayed as 10DB, while +10 becomes 10CR.

So it's definitely not 'just simple maths'. It is the convention you use to express numbers: turning debit numbers into positive, and having rules to keep the math consistent in other places. And since the original article was aimed 'at developers', I think that the widespread negative number format is much stronger.

Re: Double Entry Accounting for Developers

#156
post #117
post #9

I used ledger [1] to track all of my expenses for roughly four years. It's a command line based double entry accounting tool. It was super interesting in terms of figuring out where money went and general double entry accounting techniques. That said, it was a ton of work to keep up to date given that I was trying to track money when I spent it vs when it cleared my bank account, and those two often varied by several…

Ledger is almost great software, except that it uses signed numbers. Why?!

Depends what you mean - signs for input or signs for output?

If the reactions to TFA are any indication, compared to the amount of effort you have to go through to explain the credit/debit notation, account signs are fairly straightforward. Just start from the rule that assets are positive and you can derive the rest with some fairly basic examples.

For output? I guess you could apply some sign normalization so that Income or Accounts Payable would be positive, but if you understand where the signs come from I don't see the benefit in dropping them. The other thing to know is that Ledger itself isn't aware of what constitutes a debit vs. credit (or a "naturally positive" vs "naturally negative") account, so you'd have to tell it up-front which ones should be sign-normalized for display.

Re: Double Entry Accounting for Developers

#157

I couldn't understand double entry accounting until I found out about ledger-cli / hledger. These awful arbitrary "left-side / right-side" and "debit / credit" just doesn't make any sense. As opposed to that, no-magic approach from ledger-cli where every entry must balance is intuitive to learn and mathematically correct. And it allows to go a bit beyond the whole "assets / liabilities / expenses / income" if needed.

Ledger CLI is wonderful. I've been using it for over a year for budgeting (via envelope-style virtual accounts) and keeping track of my family expenses.

The biggest advantage is that it's just a plain text. I can read it, I can store it in git, I can backup it. If I make an error, it's easy to fix with text editor I'm familiar with. In the beginning I changed my accounts naming scheme several times and it was super quick and easy with simple sed. Previously I used GNU Cash, which is another double-entry accounting program, and doing any bulk edits was a serious pain.

Re: Double Entry Accounting for Developers

#158
post #118
post #22

Earlier quoted context omitted.

It is not incorrect. To make everything positive (and use the subtraction as you have) you need to have two different types of 'positivity' Credit and debit. And then you have to remember which things are subtracted and added so it gets back to balancing. That's why it gets so complicated. Money in your bank account is _negative_. It is a _debit_ in your accounts (this is not my invention this is true). Your bank acc…

> Money in your bank account is _negative_. Say I have two million dollars and deposit one million in the bank and buy a one million house. What is the value of my assets? -$2mn? $0mn? Something else? The "confusing" answer would be that the value of my assets (which is equal to the value of my equity, as I don't owe anything to anyone) is two million dollars.

In a conventional double accounting system:

  Deposit
  Asset>Cash in Hand CR$1m
  Asset>Bank: DB$1m

  House purchase
  Asset>Cash in Hand CR$1m
  Asset>Property: DB$1m
So all I'm suggesting is to use of negative numbers instead of tracking everything in terms of credits and debits.

  Deposit
  Asset>Cash in Hand $1m
  Asset>Bank: $-1m

  House purchase
  Asset>Cash in Hand $1m
  Asset>Property: $-1m
In either case the value of your assets at the end is unchanged, because you're just turning assets into different kinds of assets.

But let's say you started with DB$2m (inheritance say, or you won the lottery). You end with DB$2m assets.

I'm not reinventing anything here. Where do you want to label your $2m as 'debit' every time, or use negative numbers, either way is the same.

People do always struggle when learning accounting to comprehend how money in their assets is debit. Because they are so used to seeing 'credit' on their bank statements. But it is only credit because there was from the banks point of view.

Re: Double Entry Accounting for Developers

#159
post #158
post #118

Earlier quoted context omitted.

> Money in your bank account is _negative_. Say I have two million dollars and deposit one million in the bank and buy a one million house. What is the value of my assets? -$2mn? $0mn? Something else? The "confusing" answer would be that the value of my assets (which is equal to the value of my equity, as I don't owe anything to anyone) is two million dollars.

In a conventional double accounting system: Deposit Asset>Cash in Hand CR$1m Asset>Bank: DB$1m House purchase Asset>Cash in Hand CR$1m Asset>Property: DB$1m So all I'm suggesting is to use of negative numbers instead of tracking everything in terms of credits and debits. Deposit Asset>Cash in Hand $1m Asset>Bank: $-1m House purchase Asset>Cash in Hand $1m Asset>Property: $-1m In either case the value of your assets a…

I'm not talking about credits and debits. In the version of accounting I know the balance sheet (edit: I'm not talking about the transactions, I'm talking about the aggregate balance) says simply:

  ASSETS
  ======

  $1mn Cash (in the bank) 
  $1mn House
  ----
  $2mn
What does the balance sheet look like for you? -$1mn plus -$1mn, i.e. total assets -$2mn?

Is that less confusing than total assets being $2mn when you have two assets worth $1mn each?

Re: Double Entry Accounting for Developers

#160

Earlier quoted context omitted.

I think that's missing the point of the original article. Of course you have to present a view of the accounts that is consistent with accounting rules and conventions. But that doesn't necessarily mean you have to adopt that external view as an internal model for any software you're writing.

At audit time the world of “holy shit what were these people thinking?” will be colossal, because we do not get to pretend that a system is a black box at audit time. If those records don’t make sense to an accounting professional, then they’re fucked up, and that’s all she wrote. The world of audit has seen a million shysters try to falsify their books under the guise of alternative methods, and they are not interes…

Yeah I've worked on so many systems that dealt with money. Telephone invoicing, business accounting, ticket sales, etc.

One of the businesses I worked for did online invoicing and they initially started off without double ledger accounting. I was employee 30 or so and I kept repeating "we need double ledger accounting" every month or so. Nobody really listened to me (to be fair I was young, but this was after the telephone invoicing job) until the cracks started to form. It took them years to transition to a new system. Do not re-invent accounting with your own terms. International commerce runs on it and it has figured out a lot of the edge cases.

Post reply on HN