14 ms·
Double Entry Accounting for Developers
- adamcharnock 6y agoOh wow, I posted this earlier and assumed it hadn't been picked up. From people's comments here it sounds like I may have missed the mark on some of this. Pull requests always gratefully received. 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.
- goat_whisperer 6y agoHey! Hope any criticism didn’t come off too harsh. I appreciate the effort that went into this! 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.
- adamcharnock 6y agoHey! Only just see this comment, no worries at all. I can take it all in my stride :-) 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.
- deleted 6y ago[deleted]
- samfisher83 6y agoI think the most important equation to understand about accounting is assets = liabilities + equity ROA, ROE, etc come from the above formula.
- talaketu 6y agomore basic: Assets = Net Equities In other words, "all the assets are claimed". Owners equity is the the balance of the assets once other claims are discharged.
- kgwgk 6y agoMaybe you mean Equity = Net Assets ? That would make some sense.
- sago 6y agoI always felt that equation was confusing. Because then the sign has to be taught separately, or numbers have to have two columns (credit and debit) and you need to understand where each one is. 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
- watsocd 6y agoYour formula is not correct. If you want to do it that way, it should be assets - liabilities - equity = 0. 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.
- sago 6y agoIt 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 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)
- goat_whisperer 6y agoFrom 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 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.
- akgoel 6y agoEven bullet 4 has assets and expenses multiplied by -1. Completely .... wrong. Maybe this might work for a bank where assets and liabilities are sort of flipped from a non-bank business?
- sago 6y agoI agree. Except I think you're being generous :) 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.
- patmcc 6y agoBanks and non-banks don't treat assets/liabilities in different ways in accounting - banks just engage in transactions most other businesses don't, as a normal matter of 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.
- navaati 6y agoExcept Fractionnal Reserve. It kinda throws off the idea, how do they do then ? 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" ?
- mehrdadn 6y agoI kind of expected to see a good, pragmatic explanation of why double-entry accounting is useful, the kinds of mistakes it catches, etc... kind of weird to see almost no emphasis on the double-entry nature at all.
- dsimms 6y agoI agree: it catches entry errors, which is really handy in a system where you're hand-writing them twice. 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.)
- HeavenFox 6y agoI once used Mint, which is single entry. One day I logged into my account and noticed my net worth is a bit off. Looking at my monthly expense and income, I didn't see anything out of ordinary, so I just shrugged it off. 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 :)
- pbourke 6y ago"debits and credits balance" is a very useful constraint to have in your system in order to maintain data integrity. Transactions can also get quite complex - think of a salaried payroll deposit - this is a transaction with 5-10 splits from various accounts. Even a typical ecommerce sale might have 4-5 when you include commissions owed, shipping, sales tax, etc.
- mumblemumble 6y agoOne thing I really appreciate about YNAB is that they ditched the obscure words with murky Latin roots and rules to memorize about flipping signs and whatnot, and just used the words "inflow" and "outflow". They don't mean anything different in this context than "debit" and "credit." But still, somehow, when you use the traditional words, the topic seems to be as difficult to explain as monads, while with the YNAB terms it ends up being obvious and intuitive.
- gowld 6y agoThe problem with "debit" and "credit" is that everyone learned the words backwards, thanks to the banking industry's terrible UX. "Your" debit and credit accounts are actually the bank's accounts for their relationship with you. So when you start being your own enterprise, you have to unlearn the two most fundamental words you know.
- Ozzie_osman 6y agoThis is the right model, and the easiest way to explain it. It's all stocks and flows. A balance is a stock, a transaction is a flow. A flow has to happen between two stocks, and the sign in each side is opposite so it adds to zero
- jamesmackennon 6y ago...but sometimes things aren't inflows or outflows. Depreciation is neither, yet it's (almost) fundamental to accounting.
- mumblemumble 6y agoDepreciation is also neither a credit nor a debit. 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?"
- 6y ago
- war1025 6y agoI 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 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. [1] https://www.ledger-cli.org/ https://www.ledger-cli.org/
- accrual 6y agoThis is what I use as well and I concur it can become pretty tedious. My biggest issue is with Amazon purchases - I can enter everything in at the time of purchase but Amazon will batch together various charges, so what I have in my ledger never matches my credit card statement unless I carefully sum the correct batches together. First world problems, I suppose.
- juped 6y agoLedger is almost great software, except that it uses signed numbers. Why?!
- adamnew123456 6y agoDepends 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.
- Havoc 6y agoCan’t tell whether it’s intentional as part of this slightly modified approach, but under classic accounting the contribution in the first example would be equity not income. 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
- skissane 6y ago> >accountants don’t like negative numbers. > 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?
- dragonwriter 6y ago> 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.
- mtlynch 6y agoOne of the best developer-oriented explanations of accounting I've read is "Accounting for Computer Scientists" by Martin Kleppmann.[0] He explains double-entry accounting visually in terms of graph theory. Even though I'm not very good at graph theory, I found the diagrams and explanations extremely intuitive. [0] https://martin.kleppmann.com/2011/03/07/accounting-for-computer-scientists.html https://martin.kleppmann.com/2011/03/07/accounting-for-compu...
- zzo38computer 6y agoI had the same idea once, with the same sort of diagrams, except without the colours.
- kortex 6y agoOooohhhhhhhh. 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.
- tzs 6y agoHere's one for computer scientists: "Accounting for Computer Scientists" by Martin Kleppmann [1]. It was discussed on HN [2]. There have been several reposts of it since then, including one 8 months ago, but only the original got any discussion. [1] https://martin.kleppmann.com/2011/03/07/accounting-for-computer-scientists.html https://martin.kleppmann.com/2011/03/07/accounting-for-compu... [2] https://news.ycombinator.com/item?id=2298471 https://news.ycombinator.com/item?id=2298471
- audiometry 6y agoYeah, Klepperman's is the best explanation I've read of accounting. (And I had a college course on the subject). The clarity of it reminds me of the classic "Calculus Made Easy" text. 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.
- zzo38computer 6y agoI learned double entry accounting. "Debits decrease and credits increase" is just one way to represent the numbers; I have also seen the other way around (where debits are positive). But more commonly, the presentation is such that debits increase the accounts on the left, and credits increase the accounts on the right. (Nevertheless, the explanation there does work.) 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.)
- 4silvertooth 6y agoCan you elaborate more on your invention, and how matrix maths work with that equation?
- zzo38computer 6y agoBAL stands for "balance", and FSV stands for "financial state vector". Let's say that you have a transaction T, where $500.00 is debited to one account and credited to another account; in mathematical notation, this can be written as: 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.
- zjs 6y agoDo you have a more complete write up of matrix accounting anywhere?
- zzo38computer 6y ago
- hn_throwaway_99 6y agoNote to people looking for job security: there is a HUGE need for developers who understand finance. The fundamental problem is that most finance people can't speak the language of software development (the biggest problem I've seen is that finance people tend to be very poor at writing out a spec of what the software should do - they're much better at looking at a set of examples and then telling you if the calculations are right or wrong). Similarly, most software developers don't know enough about the intricacies of the finance world when building financial software. 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.
- throwaway45349 6y agoInteresting. Are there any other fields which desperately need this cross culture?
- mikeyjk 6y agoThere would surely be a huge amount. Another space where you'd need a whisperer would be anywhere near regulatory data. E.g. government mandating data is reported in a certain way. These are domain specific and typically cruel and unusual.
- jonahbenton 6y agoHealth and tech. In the US the CURES act rules just went into effect. Personal health records are ours, finally, and workflows around managing and leveraging for life extension, health, quantitative self are just in early, early stages. 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.
- 6y ago
- soheilpro 6y agoIf anyone's interested, here's my (ledger-cli inspired) double entry accounting CLI application in C#: http://github.com/soheilpro/Ledger http://github.com/soheilpro/Ledger It has two interesting features: 1. Supports multiple currencies 2. Has a query language that lets you easily get various reports
- op03 6y agoNot an accountant or a mathematician, pt 4 reminded me of an issue I had dealing with numbers in a table. The annoying thing that happens with SUBTRACTION (i.e. the process that generates negative numbers) is 2 milion - 2 million and 2 - 2 both give the same result. What is lost, is whether a big change has happened or a small change. 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.
- jedberg 6y agoThere is a great podcast about how double entry accounting was a foundational invention of our modern society.[0] If you agree with that assessment, it's interesting to think of blockchain as "triple entry accounting". [0] https://www.bbc.co.uk/programmes/w3csv3gq https://www.bbc.co.uk/programmes/w3csv3gq
- yegle 6y agoOthers has mentioned text based double entry accounting tools like ledger and hledger. There are other tools e.g. my favorite beancount. https://plaintextaccounting.org/ https://plaintextaccounting.org/ is a site listing all of these text based accounting tools out there.
- CobrastanJorji 6y agoWay back when I first tried switching to using Open Source alternatives to my previous apps, I wanted a Quicken alternative and tried GnuCash. Opening the help for the first time, I found it hilarious and ever so "open source software" of them that the help document opened with a whole chapter on how double book accounting worked, because of course you'd need to know that if you wanted to use GnuCash well. 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-accounting1.html https://www.gnucash.org/docs/v4/C/gnucash-guide/basics-accou...
- mcjiggerlog 6y ago"GnuCash" was the first thing I looked for when I opened this thread. This application is an absolute godsend and I'm not sure why it's not more popular with developers. It takes some getting used to / setting up, but once you understand how it works it will revolutionize the control you have over your finances.
- robertlagrant 6y agoThat sounds less hilarious, and more extremely useful free info and software.
- arnonejoe 6y agoThe debit and credit statement is incorrect. It depends on if it's an Asset, Liability, Equity Revenue or Expense. 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.
- jonahbenton 6y agoPresumably that means the Finance/Accounting was a waste of time. That's too bad. From an opportunity perspective the combination of accounting and CS has never been stronger. The tech in debt and banking is going through total wholesale rebuilding over the next 10 years. Asset tokenization changing the definition of ownership. On and on. Hope you get to leverage that special expertise. Good luck.
- dragonsh 6y agoPlease take a look at document [1] by author of beancount regarding how to do double entry accounting, including introduction to single entry bookkeeping. So far I find this is the best resource for developers to learn about accounting along with illustrations. Debit and Credits are introduced later once the basics are explained in details grounded in accounting principles in play for thousands of years. [1] https://beancount.github.io/docs/the_double_entry_counting_method.html https://beancount.github.io/docs/the_double_entry_counting_m...
- stilley2 6y agoThanks, this was very helpful.
- braho 6y agoNot only is Martin Blais' explanation very helpful, his software, Beancount, is also very suitable for any personal finance projects, especially if you have a background as Developer. Personally, I combine beancount with fava and find it much better than e.g. GnuCash.
- neolog 6y agoIs beancount the kind of tool that's mostly useful if you put a lot of time into it, like Emacs? Or is it immediately useful with even small investments of time?
- eginhard 6y agoI found it easy to get started with the very basics (e.g. recording of simple transactions) and I'm just reading up more over time on how to handle more complex things like splitting expenses with a partner or investments. Thanks to Python I was also able to customise my setup almost right away. There is also an Emacs mode for those who have already made that investment.
- hesk 6y agoI found ledger-cli (upon which beancount is based) immediately useful. However, since you mentioned Emacs, I should say that I use ledger-mode in Emacs to add entries. But I do most of my reporting directly on the command line.
- kazinator 6y agoThat's the silly, confusing view of accounting. 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.
- racecar789 6y ago#1 and 2 are generally correct. Personally, I would remove the quote "nothing about assets, liabilities or equity". Accounting is "all about" those accounts. #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.
- kazinator 6y agoThat is wrong; the equity and liability accounts run negative in this view, because they represent external interests in the business. When equity increases, the equity account representation of it decreases; i.e. decrements toward negative infinity. > 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.
- ron22 6y agoBelow are some really great free video courses to learn accounting fundamentals from Johnson County Community College. intro to financial accounting https://www.youtube.com/watch?v=ZkZ6Q67Q15E&list=PL259DBFA47F3B4761 https://www.youtube.com/watch?v=ZkZ6Q67Q15E&list=PL259DBFA47... intro to managerial accounting https://www.youtube.com/watch?v=2cC9SZ3RC8Y&list=PLHhe-2tIHRqEw5JRX6trtsLLlwwbpdXJX https://www.youtube.com/watch?v=2cC9SZ3RC8Y&list=PLHhe-2tIHR...
- preek 6y agoIf we’re talking “accounting for developers”, I’d like to plug the FOSS accounting system we wrote which uses event orientation to model the entities that a business owner actually things of (invoices, wages, etc). Side effects like taxes and legally required artifacts can be generated by rules. We’ve used it successfully for the last years to do our companies bookkeeping. https://github.com/200ok-ch/easy https://github.com/200ok-ch/easy
- zrkrlc 6y agoHuh, you used `clojure.spec` but then used YAML. I get it for the UX reasons, but I would have guessed you'd be generating edn under the hood.
- rahimnathwani 6y agoI'd recommend you avoid this article. It is more confusing than necessary, and the accounting entries (at least in the first example) are wrong/unconventional. 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'
- galaxyLogic 6y agoI think simplest rule for remembering what debit and credit mean is that "debit" means "deposit/indebted" and "credit" means "to give someone credit". Thus 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.
- captainmuon 6y agoI 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 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.
- kgwgk 6y ago> People emphasize the error detection, but these errors can only exist in the first place because of the requirement to record each transaction twice. 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.
- deleted 6y ago[deleted]
- captainmuon 6y agoNot really. In double entry bookkeping you have to always add every entry "twice" (I'm not sure how prevalent it is to have split entries, $20 in one and $10+$10 in another - I've learned in school that you don't do that). 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.
- buyx 6y agoAccountancy 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.
- keegancsmith 6y agoAlso 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.
- dom_hutton 6y agoI suspect accounting is a topic common in commonwealth countries curriculum (heh no pun intended) - Australia included it as well.
- jimnotgym 6y agoBut the UK doesn't! That probably tells you something about the UKs relationship with the commonwealth.
- msaadat 6y agoAccountant here. This article is just wrong. You could memorize debit/credit rules but when dealing with non-finance persons, I avoid mentioning debit/credit as it gets confusing and generally its not needed anyway. Here's how I would explain basic accounting (income statement is ignored for simplicity). 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.
- ourmandave 6y agoLately a lot of "Hello World"s has been replaced with "To Do List" examples. Maybe we should start using "Debit/Credit Journal" instead.
- levosmetalo 6y agoI 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.
- virgoerns 6y agoLedger 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.
- speleding 6y agoThe straightforward approach of ledger-cli also means you don't run into arbitrary limits any time soon. 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.
- mwexler 6y agoModeling the problem for devs is actually not the hard part, the math is somewhat simple for the accounting part (time value of money gets more fun, but I digress). The hard part for me still is undoing years of language baggage associated with words like Debit and Credit, which Increase and Decrease things that are treated as negative or positive depending on pov. In almost every case, I interpret the meaning wrong, and have to reparse. 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.
- naringas 6y agoI suspect that some of the language of credit and debit is so old that it was created before postive and negative integers were widely accepted