390 points · by adamcharnock · 6y ago · 233 comments
[1] https://beancount.github.io/docs/the_double_entry_counting_m...
Personally, I combine beancount with fava and find it much better than e.g. GnuCash.
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.
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.
> 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.
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.
In retrospect I wish what we learnt in High School was more focussed on personal finance than essentially constantly doing double entry data capture.
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.
[1] http://a1.amlimg.com/ODhlOTU0NjZkODUxYWU1OTAwOWUwYjg3YmM0OGV...
This is the non-intuitive part for me. Everything else seems logical. Why would you debit an asset when it increases?
Debts aren’t good or bad.
Just remember: “debits come in, credits go out”.
"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 debit/credit. I’ve simplified this on the backend as I strongly feel this is a presentational issue, and not a business logic issue."
I mean, this is just....wrong. Maybe I'm not smart enough to see why this isn't completely incorrect? I mean I feel mathematically this will work but goes against so many core accounting principles it won't have much use except in the simplest of cases.
The easy way to remember this is just to think that the right hand side is what you think it should be, and the left hand side isn't.
Double entry book keeping is under appreciated - it's one of the earliest examples of error correction and detection coding kicking around.
Let’s say you have a bank account. Your view of that account is opposite from the bank’s view.
You have $100 cash. That’s an asset from your POV, and it carries a debit balance on your books - when you received it, the cash “came in”.
You walk into the bank and deposit it. The cash goes out of your books, but an asset (the increase in your bank account) comes onto your books. You credit cash and debit asset.
From the bank’s POV, cash came in - they debit their cash account. And they credit your account in their books. That account is a liability from their POV - they owe you the money.
Notice how the debit and credit to cash even balanced across entities. If you talk about pluses and minuses, you’ll get confused quickly.
One of the worst things that ever happened was banks issuing “debit cards”. When you take cash from an ATM, it’s a debit from the bank’s POV. The bank carries your account as a liability, which carries a credit balance. (You are the bank’s creditor!)
So the bank debits your account (credit came in again) and credits their cash (cash went out).
You credit the bank account on your books (asset went out) and debit your cash (cash came in)
Just remember that a “debit card” reflects the banks POV and don’t let that confuse you about the meaning of “debit”. Debiting an asset is generally a good thing!
When making accounting transactions, debits always balance credits - meaning they total to zero in the code itself. It’s conventional to make assets positive (hey, having lots of assets is good, right?).
OP gains nothing but confusion by turning everything upside down.
I agree. However, the problem is that you can either make the vocabulary consistent or you can make the math simple, never both.
Making the math simple means you have to make a decision to always treat debits as positive and credits as negative or the other way around. You just have to be consistent.
Making the vocabulary work means you have to switch signs based on account type. But that makes the math and hence the software complicated and error prone.
Assets being positive makes sense. But debiting an asset account to make it more positive is counter intuitive. And expenses being positive doesn't make much sense either, because having lots of expenses is not so good, is it?
We're just accepting the inconsistent vocabulary as a price for having a simple mathematical model.
That is the complete opposite of common usage. When I get a credit on my credit card statement, it means money is coming in to me. When I get a debit on my debit card, it means money is going out from me. It's not rocket science, or at least it shouldn't be. And yet somehow accountants have managed to turn it into something even more confusing.
It’s likely the only reasonable implementation of a blockchain but we won’t know that for sure until cryptocurrency matures enough to develop reasonable controls. I’m not holding my breathe because then it’s just an accounting system with reasonable controls built in and there are already more than enough of those built with databases.
OP has chosen a consistency in the operation of debit+credit sign and applied a 'display adjustment' to implement the classification. This actually sounds like a lower entropy way to remember it -- no left hand/right hand stuff, just 'There two account types are sign reversed on display'. But it will confuse anyone who isn't indoctrinated to the convention, but one could argue that it is these various conventions that make double entry seem arcane in the first place!
It's beyond wrong. The developer here is redefining established accounting terms because he doesn't like their inconsistencies.
How so?
> The developer here is redefining established accounting terms because he doesn't like their inconsistencies.
Yes. What's wrong with fixing inconsistencies? Established accounting terms are from 500 years ago when people had trouble with subtraction.
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 outside world.
Nothing, if you can convince the entire user base to do it at the same time. If you decide to unilaterally fix inconsistencies, you've just made it impossible to understand what anyone is saying without additional metadata saying which version you're using.
And if you start telling learners that your "fixed" version is all there is, hiding the actual standard that most of the world uses, you are basically lying to them and setting them up to fail.
There are no inconsistencies to fix; the credit/debit model is fully consistent, just implementation inconveniences. And I don't think anyone would have trouble with this if it was titled “implementing double entry accounting in software” rather than “double entry accounting for developers”; that is, it's a fairly decent explanation of how, if you have preexisting understanding of the domain, to reduce it to software internals, but very bad as an explanation of the domain (whether to an audience of developers or otherwise.)
> Established accounting terms are from 500 years ago when people had trouble with subtraction.
People still have trouble with substraction compared to addition, especially with large numbers.
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.
We have an algebraic indentity, a + b = x + y. (Let's not even think about what those might represent; it doesn't matter.)
The two sides must always be equal. Any transaction must maintain that equality. Therefore, any transaction must increase both sides by the same amount, decrease both sides by the same amount, or leave both sides unchanged.
One way to ensure this is respected is to add up everything which increases the left side or decreases the right side, then add up everything which decreases the left side or increases the right side, and ensure these two subtotals match. If they do, the transaction balances, and is legal.
By convention, we call things of the first type (which increase the left side or decrease the right side) "debits", and things of the second type (which increase the right side or decrease the left side) "credits". This lets us say "debits must equal credits" as a shorthand, although again what we really mean is that the two sides must continue to balance.
The end. There's really no inconsistency here.
Then later after learning about natural account balances, it all made sense. If an account has a debit balance, a debit increases the balance and a credit decreases it. An asset or expense account has a debit balance.
Credit balance is just the opposite. Liabilities, revenue, accounts. Credit is an increase, debit decrease. (I think equity too but I always have to look it up. Rarely work with equity accounts in my day to day)
Why are OE and L on the same side? Well to finance an asset, say a new car for your business, the company would either take on some debt (L) or you’d put in some of your own money (OE) in exchange for more ownership. I don’t know if that’s more confusing or less
For the most part, devs in general should not be teaching accounting. There's a reason that it is so challenging to earn a CPA.
Surely there's a big difference between earning a CPA and just knowing the basics of accounting.
I had a summer job helping out with entry in a family member's small accounting firm. I don't think that double entry accounting is that crazy of a concept that it cannot be grasped by someone without a degree in the field.
That doesn't change the fact that I'd be wary of any accountant writing a blog post on how to write good quality code for production. Are there accountants out there who can do a good job of that? Absolutely. Are there many more accountants who would do a poor job of that? My guess is also yes.
It's more a case of someone who has one year of writing JavaScript shouldn't be writing on the theory of software development.
I wouldn't call it wrong per se, but it's about what would happen if I as accountant designed a database architecture. It would work, but any programmer looking at the dodgy code would think "omg what have you done?"
All account balances should normally be positive. Depending on what side of the balance sheet they are, a debit or credit could increase or decrease an accounts balance.
Everything else follows from that idea plus a bunch of terminology.
From my experience, if you're doing accounting beyond a hobby, you likely want to follow whatever GAAP (generally accepted accounting practices), and likely need to consult references for how specific cases are represented. If you then don't use the same language and conventions as everyone else, it's just even more of a pain than it is.
My experience here is that I was with a large audit company, albeit as an actuary rather than an accountant. I did have the opportunity to dig quite deep accounting records of insurance companies there. Now I own an incorporated company and do my own accounting and taxes (with GnuCash for accounting, even if I hand-rolled reporting for XBRL export and all).
Best of luck!
A transaction has two polarities, because it represents a flow of value. The credit side is the source, the debit side is the sink/destination/whatever. Let's temporarily pretend that every transaction hits exactly two accounts for the moment (which is not true), to make it easier.
Let's say we have $1000 in Cash, which is an Asset, and we want to buy a Pizza, which is also an Asset, for $20. How does this look in accounting?
Cash provides the source side, and Pizza provides the sink. Cash is credited $20, and Pizza is debited $20. If we ran the balances now, Cash would come out to $980, and Pizza would come out to $20.
Let's unwind that transaction. We're a business; we don't trade cash for pizzas. We contract for delivery of pizzas with a pizza vendor, who invoices us.
So here we are, with $1000 in Cash and $0 worth of Pizza. The pizza delivery driver comes, and hands us a pizza and an invoice. We know we have to debit Pizza $20; what is the credit source for this debit? Well, the pizza vendor has actually extended us a loan worth $20, in a sense (this is called "trade credit"), and the offsetting entry is the fact that we owe the vendor $20, as memorialized in its invoice. This goes in a Liability account, usually called something like Accounts Payable.
Current balances (if we ran them - "running the balances" is thought of by accountants as a discrete operation, just FYI):
Assets/Cash $1000
Assets/Pizza $20
Liabilities/Accounts Payable $20
Accountants think of accounts as being naturally debit-increased, like Assets, or naturally credit-increased, like Liabilities. I find it a bit misleading to try to think of these as positive or negative signs, as you might be inclined to at this point. It's just $20 - don't even think of it as cr $20, IMO. (dr and cr are the abbreviations for debit and credit.)Let's just leave that on the books and eat the pizza. After eating the pizza, we no longer have $20 worth of pizza, so we have to credit Assets/Pizza $20. What do we debit to offset this - i.e., where did the pizza value flow to? In this case, it would be a Depreciation account (these are debit-increased) - something like Depreciation/Eaten Pizzas. So we have:
Assets/Cash $1000
Assets/Pizza $0
Depreciation/Eaten Pizzas $20
Liabilities/Accounts Payable $20
(a commenter below points out correctly that this would be an Expense, not a Depreciation, and I'm still in the edit window!)Meanwhile, someone pays us on one of our invoices, which we had sent out earlier offscreen. When we delivered our fine $50 widget and invoiced the buyer, we entered that into our accounting system as a debit of $50 to Assets/Accounts Receivable, and a credit of $50 to Assets/Widgets. This part of the system looks like (we still have 9 widgets in stock):
Assets/Cash $1000
Assets/Widgets $450
Assets/Accounts Receivable $50
But now that the invoice is paid, $50 of value flows from our receivables asset into our cash asset - i.e., we credit A. R. $50, and debit cash $50. Getting paid is nice. Assets/Cash $1050
Assets/Widgets $450
Assets/Accounts Receivable $0
After the customarily long delay, our accounts payable department has approved payment of the pizza invoice. Cash has to be credited, because cash is flowing out, and it's probably easy to guess the debit where it goes to - that's right, our Liabilities/Accounts Payable is finally cleared, because we don't owe the pizza vendor $20 anymore. Assets/Cash $1030
Assets/Pizza $0
Assets/Widgets $450
Assets/Accounts Receivable $0
Depreciation/Eaten Pizzas $20
Liabilities/Accounts Payable $0
Hope that makes sense. It gets more complicated in real life. Accounting is nontrivial. If there are any accountants in the thread, maybe they can correct any errors I've made.Ledger entries look (conceptually, not literally) like this:
|tx id| account | debit|credit|
| 123|Cash (bank 1) | 25| 0|
| 123|Cash (bank 2) | 25| 0|
| 123|Accounts Receivable| 0| 50|
with the constraint that a transaction is not valid unless the sum of debits equals the sum of credits (and, no, you can't have both nonzero debit and credit in one line, though sometimes both are zero).Accounting is, of course, way older than computers, so accountants like to regularly "close the books" (checkpoint the state and generate reports).
Aside, I think the mental block for techies when it comes to accounting is just that many don't want to accept that accountants understand accounting. It looks like databases to them, and those are TECH!
I think a large factor in the "programmers reinterpreting accounting" phenomenon is the fact that accounting is full of somewhat idiosyncratic terminology and conventions which are somewhat counter to modern mathematical conventions. These conventions should still be upheld in order to be mutually intelligible with the accounting world, but it seems quite unlikely they are the optimum in terms of ergonomics and ease of understanding. If we designed accounting from scratch today, I doubt we would end up with these conventions.
A naive programmer is perhaps in one of the best positions to see these idiosyncrasies and think "This is using the wrong conventions and can be made much simpler by just shifting some signs around!".
Maybe this might work for a bank where assets and liabilities are sort of flipped from a non-bank business?
For example - if you're holding someone's money for them, that's a liability - you have to pay it back some time. If someone owes you money, that's an asset - it's worth something. Banks use the cash from liabilities (people's savings accounts) to pay for assets (mortgages) and make money on the spread.
Let's see, when they lend money they don't have (which is what it is) they increase the number on your account, that is they create a big liability for themselve. On the other hand they create an asset wich is your debt to them. So accounting-wise, it works out, like theorically I could do that (lending) even if I have €0, it's all paper.
But then you're gonna go and empty that account to buy your house, reducing their liability and taking (reducing) their cash instead... that they don't have !
So how does it work ? Does it just work because you don't actually buy houses with bills and coins but with bank transfers, then just shifting the paper magic to another bank ?
To be honest I know they can do something my broke self can't, and it has to du with central banks, but what is it exactly ? Something like "if everybody happens to empty their account to cash at the same time, don't worry mate we'll print them bills and give them to you, pinky promise" ?
It would not work for a bank. The only reason they 'sort of flip' is that they give your account from their perspective. Your statement is a slice of their accounting.
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.
[0] https://martin.kleppmann.com/2011/03/07/accounting-for-compu...
It just clicked for me what to "open an account" acually means. Literally adding a node to the DAG, or in the old school accounting world, creating a new page in the entry book.
I had a colleague who (over years of experience) got to be so good at teasing out requirements from the finance people that I called him "The Finance Whisperer". His skill at crossing the finance-software worlds was unparalleled, and he could command a large premium for this knowledge.
Just sticking another "Business Analysis" person in the mix just means there are more hand-off points where things can slow down and get confused.
For a bigger company, the BA path (or SME - Subject Matter Expert, might be a better term) is like bringing in a expert in the team on finance. No different to bringing in a MongoDB tuning expert, or a React expert. Yes the developers need to learn some MongoDB/React/Finance etc, but the expert is worth having.
And having the expert reduces your need for unicorn people, the 10xers etc, and you can hire regular coders who are keen to learn a bit of subject matter (they should always be!) and the smart thing to do is send them on a course (rarely see this done in the real world - the normal approach is to let them introduce a bunch of bugs, get heat from QA and learn that way).
Real estate and tech. Rona is a full on once in a lifetime disaster for much of the industry. All of the financing models are going to collapse. But the buildings are still going to be there. And there is, finally, after 25 years, a full digital title workflow. So from the smallest details of managing them to the biggest deals in financing, selling, servicing, earning, and tokenizing- green field.
In my group, there were business analysts and developers. Guess who got more comp and recognition within the company? And there were a select few who could do both - they were intensely valued.
It's good career advice especially if you're working in a capacity where engineering is supporting a business, rather than the business itself.
Balance Sheet (Assets = Liabilities + Equity)
Assets (debits increase, credits decrease) Liabilities (debits decrease, credits increase) Equity Accounts (debits decrease, credits increase)
Income Statement (Revenue - Expenses = Income)
Revenue Accounts (debits decrease, credits increase) Expenses (debits increase, credits decrease)
A few rules:
Balance Sheet Accounts carry over every year. Things like cash, accounts receivables and payables, loans and equity in the company carry over year after year.
Income Statement Accounts close out at the end of the year and close in to the equity and cash parts of the balance sheet (depending if a dividend was declared). The Income statement accounts are zero at the beginning of every fiscal year. The balance sheet accounts carried over from the previous year.One example of the above to illustrate the mechanics of double entry accounting:
Lets say you bought a car for your business in cash. you would credit cash (to decrease your cash account) and debit an asset account (a balance sheet account) for the car. when you depreciate the car over time you would credit the car account at some interval for the depreciation amount thus reducing its value and debit the expense in the current period thus increasing expenses in the current period.
The reason I know this is because completed an undergrad at ASU in finance/accounting and then CS after that. It was waste of time.
So when you start being your own enterprise, you have to unlearn the two most fundamental words you know.
Doesn't one normally handle depreciation by creating an expense account called "depreciation", and recording the depreciation as a debit in the asset account and a credit in the depreciation account?
And couldn't one just as easily word that as, "We track the depreciation by creating an account for it, and recording a flow of money into it from the asset's account?"
In which case the depreciation is cr. acc. depreciation and dr. depreciation expense.
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 days. Add on top of that three kids and various purchases my wife would make, and it just became too much of a hassle. But it also helped me understand where my money was going each month much better.
The whole double entry idea is basically that every time there is a flow of money, it is going from one place and to another.
So each transaction has two entries:
1. Where the money is going
2. Where the money came from.
That's really what it boils down to.
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.
Some time ago (while I was bored in the accounting class), I invented "matrix accounting" (I was trying to invent something else, specifically, using complex numbers in accounting, which I concluded was impossible, but matrix math works). In this matrix accounting, "debits" and "credits" don't really exist and the presentations mentioned above are really just different eigenvectors. The accounting equation has this form:
<BAL|FSV> = 0
(Note that all of the components here are real, and not complex; also note that financial vector space is a kind of projective space.) T = I + |A>$500 - |B>$500
or: T = I + |A>$500 + |B>$500
depending on what basis you are working with (since you can just define |B> to point in the opposite direction if you want a different basis vector).And then, you can have:
<BAL|T|FSV> = 0
It is easy to see that this equation is valid.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.
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.
I started using ledger-cli when I started a new business a decade ago, and it's still being used today with employees and representatives in a dozen countries and sales in several different currencies. The only problem is interacting with outside accountants who will never have heard of it.
I’m glad more accounting software is out there but tbh as accountant I can’t see myself using this. The whole debit always decreases thing kills a core part of the mental framework I use to reason through more complicated scenarios. I guess that doesn’t particularly matter though for the target audience coming at it with no prior knowledge.
>accountants don’t like negative numbers.
That’s the first I hear of that
> That’s the first I hear of that
It might be more accurate to say that Western accounting evolved before the concept of negative numbers became widely accepted in the Western world. Negative numbers were invented (or "discovered", depending on your preferences in the philosophy of mathematics) in China, and from there spread to India, and from India to the Islamic world by the Middle Ages. But when Western mathematicians learnt about them from Arab/Islamic mathematics, there was a lot of philosophical pushback – at first, Westerners didn't think the idea was valid. The idea was rather alien to the Western philosophical tradition originating in Plato and Aristotle. It was only really in the 19th century that Western mathematicians overcame all their philosophical objections and embraced them wholeheartedly. And then it took even longer for the concept to spread from academic mathematics into other disciplines and general education. By then, a lot of the Western tradition of accounting and bookkeeping had already formed without any reliance on the concept of negative numbers. (The concept of "credit" and "debit" serves a somewhat similar function, but is not quite the same concept.)
And accountants do use negative numbers. But, maybe if modern Western accounting had developed in a culture that looked on negative numbers more positively (excuse the pun), they might use them much more than they do?
The division of accounts into credit- and debit-normal with a strong anti-negative-entry bias (to the point of contra sub-accounts for recurrent activities that go in the opposite direction of the parent account’s normal) seems to me like it provides an important QC feature, especially when books are kept or reviewed manually. It's a lot easier to see “this is not the kind of thing that belongs in this account” than “that is not the right sign for that activity”. And the resulting categorizations are useful in their own right, and it's important to remember that accounting is not just about adding numbers, but about categorizing the associated activities.
The articles mentioned by dragonsh (Beancount documentation) and mtlynch (Martin Kleppmann's site) are great. But I feel unsatisfied by the way they discourage understanding of debits and credits, by just giving you something to memorize, e.g.
"Now, by convention, accountants flip the sign on all of the blue and pink nodes’ balances, which means that the two sums end up being equal. And that’s why it’s called a balance sheet."
You don't need to memorize which accounts are negative and which are positive. Just relate them to the English words 'debtor' (someone who owes money) and 'creditor' (some who is owed money), and you can work out the right entries for any transaction.
You credit (CR) an account when you're recording:
- an increase in the amount your company owes, or - (equivalent) a decrease in the amount some other entity owes your company
The other entity could be a supplier, a customer, or one of your own shareholders.
Examples of credits that can be identified by the above rule:
- A customer pays you some money they owed you: CR 'Assets - Accounts Receivable'
- A supplier sends you an invoice: CR 'Assets - Accounts Payable'
- You send an invoice to a customer: CR 'Revenue'
The last example might be confusing at first. Why is revenue like something you 'owe' someone? Because any profit the company you make does not really belong to the company, but to the shareholders.
If you can work out whether one side of a transaction is a debit or a credit, you know the other side is the opposite. So, for the above transactions:
CR 'Assets - Accounts Receivable' / DR 'Cash'
CR 'Assets - Accounts Payable' / DR 'Expenses'
CR 'Revenue' / DR 'Assets - Accounts Receivable'
[1] https://martin.kleppmann.com/2011/03/07/accounting-for-compu...
In contrast, the article in this post is terrible. Tons of footnotes referring to exceptions. I feel like the author is trying to summarize a subject he doesn't understand himself.
intro to financial accounting
https://www.youtube.com/watch?v=ZkZ6Q67Q15E&list=PL259DBFA47...
intro to managerial accounting
https://www.youtube.com/watch?v=2cC9SZ3RC8Y&list=PLHhe-2tIHR...
Here is the smart view:
1. The sum of all accounts is zero: that's the fundamental equation. Nothing about assets, liabilities or equity.
2. A transaction updates at least two accounts, by applying deltas to them. The sum of the deltas is a transaction zero. Because of that (1) continues to hold.
3. Accounts which represent outside interests in the business run negative: these include loans and owner's equity. For instance, if the business somehow makes $1000 out of thin air, its cash account goes up by $1000. At the same time, because the owner has interest in the business, the equity goes down by $1000. Equity is like a loan that the business owes to the owner. Or, if the business gets a loan for $1000, the cash goes up; but the loan account goes down by $1000. Other accounts are what the business has, and run positive, like expenses, cash and assets. E.g. if a routine $50 expense is covered, cash goes down by $50, expenses goes up by $50.
4. Expensese are periodically reconciled (e.g. end of year): they cancel out equity. If there is -$1500 equity, and $500 expenses: poof: expenses are blasted to zero, and equity goes to $-1000. (Of course, expenses are also, separately of this, used for claiming tax deductions and whatnot.)
That's it; no confusing debit/credit nonsense, with an increase in such and such account being a debit, but an increase in another kind being a credit. That system is deliberately twisted so that people of typical intelligence need to rely on expensive accountants.
#3 couple edits: Change "the equity goes down by $1000" to "either equity or liabilities will increase by $1000". Equity will either remain the same or increase when a business obtains $1000 out of thin air.
Change "the loan account goes down by $1000" to "the loan account goes UP by $1000". Obtaining a loan will increase cash/increase liability accounts.
#4 is correct.
This is the same as conservation laws in physics; e.g. integral over a closed path over a conservative field. Or the Kirchhoff voltage law (sum of voltages around an electric circuit is zero).
Debit/credit accounting is like designing a circuit in which for some silly reason we decided to mix conventional current and electron current! Oh, this is a liability resistor, so we use electron current, but this is an asset capacitor, so we use conventional current. The circuit law then doesn't add to zero, unless you remember which elements need to have their sign flipped, and you end up with strange rules like equity volages equal asset voltages minus liability voltages.
Can you imagine doing such a thing when designing a device with hundreds of parts? Yet, big ledgers can likewise have hundreds of accounts. Then a corporation needs a small army of accountants to keep a simple thing straight.
It's not just the adding to zero that is crystal clear, but the polarities of the accounts. When I see a negative balance account in the ledger, I have a good idea that it's an equity/liability account just from the balance alone. Minus means owing, plus means having: very clear.
> Equity will either remain the same or increase when a business obtains $1000 out of thin air.
By "out of thin air" I meant that the business doesn't owe the money other than to its owners as equity. Like say the business won that in a lottery or something.
> Obtaining a loan will increase cash/increase liability accounts
You don't get the system obviously; you're thinking in the broken credit/debit system.
At least you have the good taste of keeping assets positive, unlike other people. :-)
Under the sum-to-zero system, it's very simple. Negative-running accounts is what the system owes to the outside, including to its owners. Positive accounts are what it holds. It doesn't own anything: all of what it holds is either owed to its owners, or else to other creditors, so the sum is zero.
A transaction can update two or more accounts. The only rule is that all the deltas in the transaction add to zero.
That's as far as keeping balance is concerned: of course, the transaction has to reflect reality and accounting principles. For instance, if $1000 is injected into the business somehow (the company wins a lottery draw), that could be mistakenly applied as "+1000 cash, -1000 bank loan" which validates, due to summing to zero. But it looks like the company made a $1000 draft against the bank loan, which doesn't reflect what happened. The correct transaction is "+1000 cash, -1000 equity": the company is $1000 richer and so the owners have a greater interest: it "owes" more to the owners. (It's sort of as if the owners actually got the money, and loaned it to the business).
The debit/credit system's rule that a transaction must have a credit and debit of equal size also do not prevent bad transaction semantics: transaction from using the wrong asset or liability/equity account. It's just a gratuitous complication which provides exactly the same sanity check as summing to zero.
In my accounting system for self-employment, I have transactions that update four or five accounts. In double-entry, that would have to be done via an awkward series of binary debit/credit pairs. Moreover, I also have some "virtual" accounts: pairs of accounts that maintain precisely opposite balances that sum to zero. These accounts provide figures useful for reporting. For instance, suppose that transactions for receiving income are broken down: income doesn't go into a single lumped account, but some of it into "cash", some of it into "income tax withholding", and some into a third account like "health fund". But, for the sake of periodic income reporting, we need the whole lump together. For that, we can instantiate a virtual account pair "income" and "income-neg". In the same transaction, "income" receives the total, and "income-neg" the additive inverse of that to keep the ledger balanced. We can query the "income" account to see the lumped income, and not have to ferret that out of the income transactions.
In the end it will come to that (when the books are closed) but to be able to generate correct income statements you may need to create some kind of income account for that gain.
> (It's sort of as if the owners actually got the money, and loaned it to the business).
But it's not really the same thing.
But if you're writing a computer system that's simply duplicating one entry from a human in two places in data store, is that "double entry"? is it useful?
But the idea that you would want to reconcile one view with another independently reported one is super useful. (Almost every financial-oriented company builds a system like that, I would bet.)
A couple of months later I finally realized I opened new savings account to take advantage of a promotion and forgot about it. The opening deposit was deducted from my checking account. Since it's classified as a "Transfer" it doesn't show up in expenses. I linked the account, and now I am a few thousand dollars richer than I previously thought.
This kind of mistake will never happen in a double entry accounting system.
It was then I began migrating my personal accounting to a double entry system I developed myself. Hopefully I can make it available to the public soon :)
Anyway, while it wasn't the best user experience, it was a pretty good introduction to double entry accounting: https://www.gnucash.org/docs/v4/C/gnucash-guide/basics-accou...
https://plaintextaccounting.org/ is a site listing all of these text based accounting tools out there.
Look at this sentence from another comment: "If your banana is for consumption and you pay cash: Then debit Food Expenses (decrease equity) and credit Cash (decrease assets)."
It flies in the face of our habitual, naive, and common use: "I'm crediting cash? But I spent it! Shouldn't I debit cash, debit is lowering? No? But if I have credit, I have more! No? Is that Comparative Literature class still available to switch into? No?"
The categorization are not always based on logic that is commonplace, and has legacy trappings. The terminology is different from what a naive reader might expect.
To be fair, many sciences have evolved this way. But like the French phrase "false friends", words that sound like one thing in another language but have a total different meaning in their own tongue, I think the struggle is to adjust mindset to the new meanings of words we use frequently, more so than the concepts of balance and systems of equations.
If you agree with that assessment, it's interesting to think of blockchain as "triple entry accounting".
Maybe we should start using "Debit/Credit Journal" instead.
None the less, the result has been some software which seems to have worked well for those that have used it. I certainly haven't received any angry issues.
I'll link to this thread from that page.
I checked out the GitHub repo. I’m a CPA who’s getting into web development and has some Django experience. Would definitely be interested in contributing.
I think Hordak could really do with a version 2 anyway. There are a number of issues open which I think would make for a big improvement, but would also result in breaking changes. I'm not precious about the codebase either, it hasn't been a priority for me for a while and it would be great to see it given some love (especially from someone with a better knowledge of accounting than I!)
Definitely get in touch if you are interested in being involved. I'd be happy to add you as a maintainer after a pull request or two.
It has two interesting features:
1. Supports multiple currencies
2. Has a query language that lets you easily get various reports
It seems much easier to me to just record the transactions ($100 from bank account to shop on date). Then you can generate balanced account sheets from this automatically.
But you can go further and look at the actual cash flow. This is something you can't easily do with double entry: how much money did I have on day X? How much money will I have approximately on day Y? Will any asset fall below a certain value? And make nice graphs out of everything.
However, I think the real value in double entry accounting is that it not only represent money you have but also things you own: If you buy a pen, you have less money, but you have an extra furniture pen and your accounting can reflect that. It can also reflect the loss of value of the pen over time.
It is also useful if you get in debt to buy something: you transfer money from a debt account to your current account, you buy the thing you wanted to buy and appropriatly report the value of what you own in accounting. You now have a thing, and a debt to be repaid in whatever term was agreed.
It's also very useful as a tool of control for state. All exchanges you have with other entities are recorded in a separate account. It's possible to take that account and check that the other entity accounting book match exchanges they have with you.
That's like saying that check digits in credit card numbers detect errors that only exist in the first place because we entered more digits. Or that checking the md5sum after downloading a binary file detects errors that only exist in the first place because we downloaded two files instead of one.
So far as I know, most actual "double-entry" accounting software just stores each transaction once in a general ledger. The appearance of doubled entries is all in the UI where it processes the ledger to present a list of transactions from the perspective of a certain account. You still get the benefit that the system won't allow the balance of one account to be increased or decreased without an equal and opposite change in other account(s)—money cannot be created or destroyed[1], only moved around.
[1] Unless you're the Federal Reserve. They play by different rules.
I'm just suggesting a different entry format where you enter the number once and the computer creates both bookkeeping entries. Yeah you have the chance to make a typo, but I guess preventing that kind of error is not what this is about, is it?
It's actually not like a checksum, but more like the DRY (don't repeat yourself) principle. Where one framework requires you to define a constant, say a SQL table name, in multiple places, and another lets you type it only once. Like handrolled SQL vs- an ORM. In this case, I think less typing is less error prone.
That's the kind of error it catches, where you entered one of the entries (say, the cash outflow) and not the other (say, the invoice you were paying) or they were not consistent.
Note it's not always as easy as "this number goes into two places". One entry in one account may correspond to multiple entries elsewhere (say, price plus tax). At least that's what I think, nobody told me not to do that or I don't remember...
And it's literaly a checksum.
https://en.wikipedia.org/wiki/Trial_balance
"The purpose of a trial balance is to prove that the value of all the debit value balances equals the total of all the credit value balances. If the total of the debit column does not equal the total value of the credit column then this would show that there is an error in the nominal ledger accounts."
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.
2015/10/12 Exxon
Expenses:Auto:Gas $10.00
Liabilities:MasterCard $-10.00
whereas I would have something like: 2015/10/12 Exxon $10.00 MasterCard -> Gas
The idea would be that the form of the transaction doesn't allow you to screw up - it is neccessarily balanced because you only give the amount once. A bit like a typed language only allows well-formed programs to run.It gets a bit trickier when, for example, sales tax is involved where a simple example for a sale of $1.000 with 25% VAT would be:
cr. revenues $800
cr. VAT patable $200
dr. accounts receivable $1000Thus for an account debits means increases in the amount held by the account and credits mean decreases. Because it is Double Entry an increase somewhere is always a decrease somewhere else. When we deposit an amount to an account we must also credit another account which tracks where that amount came from.
I prefer to think of it as if every account had a person who is in charge of that account. If money comes out of the account we give "credit" to the person in charge of that account. And when we deposit to an account we debit it, in other words the person in charge of the account becomes "INDEBTED" by that amount.
Every transaction has two legs: what it is and whose it is. That is the basis of the accounting equation: assets (what) = equity (mine) + liabilities (someone else's). An increase in assets must be balanced with an increase in either equity or liabilities, and vice versa.
We’ve used it successfully for the last years to do our companies bookkeeping.
ROA, ROE, etc come from the above formula.
assets + liabilities + equity = 0
Seemed much more general. Double entry just became: everything (transactions, whole companies) sum to zero. Then just one other little thing (where money comes from in a transaction is positive, where you put it is negative) and you have the math.
IMH(and not accountancy)O
Think of it this way. When you start a company, you invest $100. For the company accounting, that is $100 in the bank account/asset and $100 in equity. $100 - 0 - $100 = 0
Now you take a loan for $100. Now you have $200 in the bank account, a $100 liability, and $100 in equity. $200 - $100 - $100 = $0.
Money in your bank account is _negative_. It is a _debit_ in your accounts (this is not my invention this is true). Your bank account statement is from the bank's perspective. The money came from you, so it is a credit from their perspective only. Try to submit your statutory accounts with 'bank credit' and you'll get in trouble! Your software or accountant will definitely flip it to become a debit!
Your transaction to start your account:
Equity: $100 (or $100CR)
Bank account: $-100 (or $100DB)
Loan:
Debt: $100 (or $100CR)
Bank account: -$100 (or $100DB)
Accounts:
Assets > Bank account: $-200 (or $200DB)
Liabilities > Debt: $100 (or $100CR)
Equity: $100 (or $100CR)
CPAs are the OG Luddites, refusing to use negative numbers to make their jobs simpler and easier to understand.
If we deduct everything that we owe (Liabilities) from everything that we own (Assets), whatever is left belongs to the shareholders (Equity).
Or you can use negative numbers and everything just works.
Your financial software _will_ use my approach. As do the most sophisticated software of the most complicated companies. But their presentation gets mangled through a complicated series of rules for archaic reasons.
So how does this actually work? Say I worked for 8 hours at $25/hr. I get a $200 deposit in my checking account; that increases my assets. How is the sum still zero?
Income > Work: $200 (or $200CR)
Assets > Bank Account: -$200 (or $200DB)
This is exactly how it would be stored in any software system behind-the-scenes, and how it would be submitted in statutory accounts. The only thing that makes this look weird is that you are used to seeing your bank account statement with 'credit'. But that's only because the bank account statement is from their accounting perspective.
Money comes from somewhere (Positive, Credit); it goes somewhere (Negative, Debit).
The entire confusion about signs and what to add and remove, and what categories 'increase' with debit or credit, it all disappears when you allow negative numbers. I guarantee your accounting software _will_ simply store them as positive or negative. It is frustrating that it appears so complex simply because of avoiding negative numbers.
You would increase assets by $200, since you got that much cash (cash is an asset). You would increase equity by $200 as well (often accountants will call that "Owner's Equity") since your personal stake in this business (yourself, here) has gone up. That's the double entry.
And sometimes when change happened I didn't want to loose that info so I used addition instead and put it in a "special" column.