News for hackers. Stuff that matters.
Re:Double Entry Accounting for Developers by buyx on Tuesday July 28, 2020 @05:46AM (#23974035)
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 equation) A=O+L

Rules: Left side of equation: Increase in an asset: debit. Decrease in an asset: credit.

Right side of equation: Increase in liabilities: credit Decrease in liabilities: debit

Increase in owners equity: credit Decrease in owners equity:debit

Expenses decrease equity, income increases equity. Capital increases equity. Drawings decrease equity.

For every debit, there must be a credit. Every transaction fits into this framework, and every transaction must balance the accounting equation.

Your bank statement appears to be reversed, because it’s written from the perspective of the bank: for them, a deposit by you increases their liability to you (a credit). Similarly when you owe them money, it’s an debit, since from the bank’s perspective, your debt is an asset to them. (Bank reconciliation is another thing we did in school.)

This really isn’t rocket science.

Re:Double Entry Accounting for Developers by tgb on Tuesday July 28, 2020 @07:01AM (#23974414)
The stumbling block for me learning it was understanding how to record the simplest and most common transactions like buying a banana. Surprisingly many explanations only use examples like paying your home mortgage where the credit and debit side of things are clear. But then they never tell me about where on earth does my banana go as a credit since I'm not stockpiling bananas to later sell. Even though that use case is almost all of my transactions!
Re:Double Entry Accounting for Developers by buyx on Tuesday July 28, 2020 @07:32AM (#23974607)
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 (increase liabilities). Debit Food Expenses (decrease equity). Accounting equation is balanced.

If your banana is for resale and you buy it on credit: Debit Trading Stock (increase assets). Credit Loan account (increase liabilities). Accounting equation is balanced.

If your banana is for resale and it spoils before you sell it: Credit Trading Stock (decrease assets) and Debit Spoilage Expenses (decrease equity). Accounting equation is balanced.

If your banana is for resale and you sell it [this one I'm a bit rustier on, it's been 25 years, but I'm pretty sure it's correct]: Debit cash (increase assets). Credit Sales income (increase equity). ALSO Debit Cost of Sales (an expense, so decrease equity). Credit trading stock (decrease assets). Accounting equation is balanced. (Your Gross Profit is reflected in Sales minus Cost of Sales).

Granted, these are unsophisticated examples, and based solely on decades-old high school-level accountancy, but I think your banana example should be covered here.

Re:Double Entry Accounting for Developers by wodenokoto on Tuesday July 28, 2020 @08:58AM (#23975195)
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 basis of double accounting in the sense that "every thing in and out must end up equalling zero" is super sophisticated concept to grasp, at least superficially.

But once it is applied to situations where things intuitively are just going out of your budget (like buying and eating something: you're left with no money and no banana) and on top of that use counter-intuitive words, I hope you can appreciate that people get confused.

Re:Double Entry Accounting for Developers by dhagz on Tuesday July 28, 2020 @09:58AM (#23975823)
> 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 by inopinatus on Tuesday July 28, 2020 @08:40AM (#23975068)
It doesn’t quite. You’ll also need to consider allocations and accounting for tax (sales and income), depreciation, transaction fees, warehousing, shipping revenue and expenses, revenue and expense recognition, discounts, returns, overpayments, prepayments, futures, chargebacks, refunds, credit notes, invoicing, subscriptions, subsidies, tariffs, reconciliation, adjustments in the current financial year, adjustments for already reported periods, gains & losses on foreign exchange, and subledger roll-up for your parent fruit company’s GL.

You’ll need to maintain consistency and coherence in multiple combinations of the above, and when the auditors show up, be able to show unequivocally that you understood every edge case when recording and reporting transactions, especially the ones that crossed a financial year boundary.

Accounting software mechanises all this. It is not simple.

Re:Double Entry Accounting for Developers by buyx on Tuesday July 28, 2020 @08:50AM (#23975138)
I specifically stated it was an unsophisticated example. GP wanted to know what happens with the "simplest transaction" when he buys a banana.
Re:Double Entry Accounting for Developers by tgb on Tuesday July 28, 2020 @09:13AM (#23975358)
Yeah, exactly. The first or second example in any explanation should be buying a banana that you immediately eat. That way the reader sees that an "account" doesn't have to be a bank account nor even a collection of physical goods that exist, it's just a virtual bucket made to keep track of certain transactions. Until I figured that out, double-entry made no sense at all. This is all exacerbated by the common "Assets = Liabilities + Equity" equation which hides expenses entirely. All of this is, of course, a problem about pedagogy in the quick guides found all over the internet. (Including the one linked to here, though the second example is at least an expense but not in the way that would enlighten a beginner.)
Re:Double Entry Accounting for Developers by inopinatus on Tuesday July 28, 2020 @10:50AM (#23976384)
That was the simplified version.
Re:Double Entry Accounting for Developers by Krustopolis on Tuesday July 28, 2020 @11:45AM (#23976958)
Apples and oranges. By way of analogy, the OP was talking about C while you are describing building a commercial Windows app. DE accounting is a simple tool that can be used in complex ways.
Re:Double Entry Accounting for Developers by inopinatus on Tuesday July 28, 2020 @08:27PM (#23982191)
OP is neither, it is in Python, but this merely demonstrates that accounting can be incorrect in any language.

The problem isn't just terminology, but when people use the term double-entry accounting interchangeably with double-entry book-keeping, they reveal how little they know about the subject matter, and how unqualified they are to be implementing either.

Re:Double Entry Accounting for Developers by kgwgk on Tuesday July 28, 2020 @07:16AM (#23974508)
To an expense account.
Re:Double Entry Accounting for Developers by isolli on Tuesday July 28, 2020 @08:37AM (#23975049)
Same here. Even a simple transaction such as recording my salary still leaves me confused.
Re:Double Entry Accounting for Developers by keegancsmith on Tuesday July 28, 2020 @06:20AM (#23974201)
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.

Re:Double Entry Accounting for Developers by dom_hutton on Tuesday July 28, 2020 @06:53AM (#23974364)
I suspect accounting is a topic common in commonwealth countries curriculum (heh no pun intended) - Australia included it as well.
Re:Double Entry Accounting for Developers by captn3m0 on Tuesday July 28, 2020 @08:43AM (#23975091)
India here (also commonwealth). Accounting wasn’t in high school curriculum but tax calculation was.
Re:Double Entry Accounting for Developers by jimnotgym on Tuesday July 28, 2020 @07:53AM (#23974749)
But the UK doesn't! That probably tells you something about the UKs relationship with the commonwealth.
Re:Double Entry Accounting for Developers by OJFord on Tuesday July 28, 2020 @08:42AM (#23975082)
It's not compulsory, but it's available at GCSE and A Level; also in General Knowledge A Level I think.

Granted they have a bit of a reputation for being 'lesser' subjects. I don't really agree that everyone needs to be taught this though, most Britons don't have to 'do taxes', and aren't running companies. It should probably form a part of trades' apprenticeship training (and for all I know it does) due to the higher prevalence of self-employment (and thus running a business, and self-assessing tax even if not incorporated).

Re:Double Entry Accounting for Developers by MrTortoise on Tuesday July 28, 2020 @04:17PM (#23980198)
chicken and egg
Re:Double Entry Accounting for Developers by cm2187 on Tuesday July 28, 2020 @09:15AM (#23975380)
No accounting in the French general high school curriculum. And I can’t see it being introduced (it would be seen as an unacceptable intrusion of capitalism in education).
Re:Double Entry Accounting for Developers by jimnotgym on Tuesday July 28, 2020 @07:51AM (#23974734)
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 by cm2187 on Tuesday July 28, 2020 @09:13AM (#23975355)
True. Though accounting in general is rocket science. You just need to look at the thickness of the accounting standards book [1]. As soon as you are looking at a large group with several levels of consolidation spanning jurisdictions with different accounting standards and doing any operation that is non trivial, the accounting treatment becomes a minefield. Where I work we have a team dedicated at looking at thorny accounting issues. Outside of that team, I don’t think anyone in the organisation (including the financial reporting dept) can pretend to really understand everything.

[1] http://a1.amlimg.com/ODhlOTU0NjZkODUxYWU1OTAwOWUwYjg3YmM0OGV...

Re:Double Entry Accounting for Developers by everlost on Tuesday July 28, 2020 @09:21AM (#23975434)
> Rules: Left side of equation: Increase in an asset: debit. Decrease in an asset: credit.

This is the non-intuitive part for me. Everything else seems logical. Why would you debit an asset when it increases?

Re:Double Entry Accounting for Developers by wrycoder on Tuesday July 28, 2020 @09:39AM (#23975629)
Because an asset account carries a debit balance.

Debts aren’t good or bad.

Just remember: “debits come in, credits go out”.

Re:Double Entry Accounting for Developers by zo1 on Tuesday July 28, 2020 @08:41AM (#23975074)
It's also taught in quite a few CS/Software Engineering degrees there as well. Granted, not within the context of CS, but taught none the less.