Live data from Hacker News

Accounting for computer scientists (2011)

martin.kleppmann.com

21–30 of 51 posts

Re: Accounting for computer scientists (2011)

#21

I learned the basics of accounting from the GnuCash guide. [1] One of the best things I ever did. If the featured article helps you understand accounting, good! If it's something else, that's fine too. I agree with an HN comment [2] from long ago: learning the basics of accounting is a superpower. And not just when talking to finance people. I do my budget in double-entry. (Can you guess my program of choice?) It all…

> I do my budget in double-entry.

I have a short term budget in GNUCash in the form future dated scheduled transactions, but for more strategic stuff I have an annual budget spreadsheet, which among other things, models income taxes. Increase 401k contributions, and the sheet says I owe less tax. The GNUCash budget tooling is... less useful.

Re: Accounting for computer scientists (2011)

#23
Accountants use jargon in the same way that programmers do - to succinctly express commonly known and understood concepts. They do not use 'hard words'; if the words are 'hard' it's because the reader lacks the domain knowledge that accountants have been trained in.

The fact is that double-entry bookkeeping does not use negative numbers. Where confusion might arise is in the meaning of 'debit' and 'credit'.

'Debit' only means 'the left hand side', and 'credit' only means 'the right hand side'.

A debit is not a subtraction operation, nor is a credit addition. I suspect this mis-conception mostly arises because that's how it looks when a Bank 'credits' your account with your deposit - in fact it's increasing its liabilities (it owes you the money) which is recorded as an entry in the right-hand side of the liability column.

edit: typo

Re: Accounting for computer scientists (2011)

#24
The mathematical principles of accounting are explained in an innovative way here [1],[2]. Also look for the book "Algebraic Models for Accounting Systems".

Skipping mathematical formulations and going directly for a "computer science" view is not always the right path.

Unfortunately, while these references are illuminating (NB: there is an entire niche of mathematical accounting literature) after you dig into them and get the gist of it you'll realize that what is missing is a standardized textbook treatment of the special vector spaces that define accounting. This is no accident. Accounting is one of these Kafkaesque closed professions that thrive on obscurity.

[1] https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1340619

[2] https://www.ellerman.org/the-math-of-double-entry-bookkeepin...

Re: Accounting for computer scientists (2011)

#25

I learned the basics of accounting from the GnuCash guide. [1] One of the best things I ever did. If the featured article helps you understand accounting, good! If it's something else, that's fine too. I agree with an HN comment [2] from long ago: learning the basics of accounting is a superpower. And not just when talking to finance people. I do my budget in double-entry. (Can you guess my program of choice?) It all…

Seconding this, the GnuCash manual is fantastic. The principles of double entry accounting are very simple but if you're not used to thinking in those terms it can sometimes be a little confusing how to fit real life scenarios into that framework. The GNC manual has a lot of helpful explanations and examples.

Re: Accounting for computer scientists (2011)

#27

I learned the basics of accounting from the GnuCash guide. [1] One of the best things I ever did. If the featured article helps you understand accounting, good! If it's something else, that's fine too. I agree with an HN comment [2] from long ago: learning the basics of accounting is a superpower. And not just when talking to finance people. I do my budget in double-entry. (Can you guess my program of choice?) It all…

> I do my budget in double-entry. I have a short term budget in GNUCash in the form future dated scheduled transactions, but for more strategic stuff I have an annual budget spreadsheet, which among other things, models income taxes. Increase 401k contributions, and the sheet says I owe less tax. The GNUCash budget tooling is... less useful.

I agree that the GnuCash budget tooling is not useful.

I created separate "Budget" accounts (for every budget category) that are Liability accounts, and I also created a "Budgeted Money" Expense accounts.

Updating the budget for the month is done by debiting Budgeted Money and crediting the account for the particular budget I want.

Then when doing a transaction, on top of the debits and credits that would be there, I debit the budget account and credit the Budgeted Money account.

This lets me use the reports (with a little tweaking to get just budget stuff), as well as to split one transaction up into multiple budget expenditures if necessary, like for certain Amazon orders.

This is not for everyone, probably yourself included, but it does work for me.

Re: Accounting for computer scientists (2011)

#28
post #16

I'm eternally interested in learning more about accounting, but I think this is missing crucial information to actually explain what "accounting" is while laying on this patronizing anti-intellectual "accountants use hard words" writing style. 1. What are you trying to solve by "doing accounting"? After reading this article, it seems like it's some sort of arbitrary aesthetic, like people who think the point of organ…

I'll try to answer some of your questions, but I'm not an accountant.

1. You're trying to understand the money coming in and going out of a business. The organization of this information can make certain events more apparent, like whether you're actually making or losing money (this is not necessarily obvious!) how much 'runway' a company has, roughly how valuable it is (a bit nebulous because a lot more goes into it, but "doing accounting" is the starting point), whether inventory is being stolen more than might be normal, etc.

2. No idea about this guide or the coloring. TBH a spreadsheet conveys the data better than a graph. Double entry bookkeeping was a revolutionary idea though. I think it's fairly easy to forget the full effect of a transaction. I buy a $500 chair for my business, this isn't just $500 less in cash, it's $500 more in some 'furniture' asset. This accounting for every minute detail of what your business owns or owes across even dozens of transactions becomes difficult to track.

1. Look up cash vs. accrual accounting. I think I learned most of this on Khan Academy the first time, but there must be dozens of YouTube videos on it. Basically w/ accounting over time you start adding deferred accounts of different sorts like payables and receivables.

2. No idea. I think when you start getting into these topics there is either just some software solution that follows some standard or allows you to make a choice about how to use the exchange rate, or there is some specific standard set by FASB saying how to do it. But I don't know.

As a simple example of something else, with inventory, businesses can value it a few different ways including FIFO and LIFO (where they value inventory based on the price they paid least or most recently) among others. These choices are often just a preference for the business, or perhaps common for a business' industry. I suspect there might be similar methods of valuation for accounts denominated in different currency, where you could take the amount by exchange rate either on the first or last of the month or by its average rate over the month.

Re: Accounting for computer scientists (2011)

#29
post #3

Earlier quoted context omitted.

It's worth remembering that accounting was developed before negative numbers.

>I've always thought that accounting is arithmetic made difficult It basically is. The fact that operations like "debit" and "credit" behave differently based on the sign-convention of the account is legacy baggage that should have been done away with a literal millennium ago. The whole situation is as absurd as if physicists decided that the concept of a "negative" voltage was a bad thing so KVL was formulated as su…

I'm the rare old timer accountant with some programming background

I definitely agree with you though my approach to analyzing activity/preparing detailed reports/etc. is to, at a first step, convert all credits to negative numbers and retain all debits as positive

Further, most charts of accounts are designed in some sane way that you can easily tell what type of account it is (asset/liability/capital/P&L)

The challenge isn't usually managing/interpreting these things but making sure you are interpreting contracts and guidance properly/consistently so you don't upset ownership or your auditors with unanticipated changes/revisions...

Re: Accounting for computer scientists (2011)

#30
Double-entry accounting at its simplest is the accounting equation:

  Assets = Liabilities + Equity
Accounts are created that fall under one of these three categories. Each account has its own ledger to book transactions, and each ledger flows into a general ledger that keeps track of the account balances at a higher level.

Every transaction that is booked in a ledger must balance by issuing a debit and a credit.

Take Cash as an example. Cash is normally considered an asset account. Suppose you receive $10 in Cash temporarily from financing but you have an obligation to pay it back in the future. That obligation can be represented by a liability account called Accounts Payable. When receiving the cash, the following entry should be booked:

  Cash $10
    Accounts Payable $10
Here we have debited $10 to the Cash account and credited $10 to the Accounts Payable account. Both accounts balance. Revisiting the accounting equation, we can see how it still balances:

  Assets = Liabilities + Equity
  10 = 10 + 0
Now if we dive into the Cash account at a deeper level, we can represent it with a t-chart:

     Cash   
  ---------
  10  |
Similarly for Accounts Payable (A/P)

     A/P   
  ---------
      |  10 
Both Cash and Accounts Payable carry a balance of $10. Since Cash is an asset account that carries a debit balance, we represent it in t-chart form by adding 10 to the left side of the t-chart (matching up with assets being on the left side of the accounting equation). Accounts Payable carries a credit balance since it is a liability account, so we represent it by adding the 10 to the right side of the account (matching up with liabilities being on the right side of the accounting equation).

Next, lets look at what happens when we pay back $5 of our obligation. First, we book the following entry:

  Accounts Payable $5
    Cash $5
Now we have debited Accounts Payable and credited Cash, which is the opposite of their account types. This reduces the balance of the accounts, as demonstrated by their t-charts:

     Cash          A/P   
  ---------     ---------
  10  |             |  10 
      |   5      5  |
The accounting equation is now:

  Assets = Liabilities + Equity
  5 = 5 + 0
Finally, let's look at an equity account. Suppose when the business was formed, we gave it $10 of widgets (Inventory asset account) in exchange for equity in the business:

  Inventory $10
    Equity $10

  Inventory       Equity
  ---------     ---------
  10  |             |  10

    Equity
  ---------
      |  10
Pretending that the founding equity has now been introduced (because it would have normally been the first entry in the company's books), the accounting equation is updated as so:

  Assets = Liabilities + Equity
  15 = 5 + 10
Now suppose we receive $20 in cash from the sale of all of our widgets valued at $10. Our business was formed to sell these widgets, so the sale is revenue. Revenue is an equity account. The sale would be booked with the following entry:

  Cash $20
    Inventory $10
    Revenue   $10
Since Revenue is an equity account, we have increased its balance by crediting it $10, which is the difference between the cash received and the value of the widgets we sold. The t-charts for the account balances in the transaction are the following:

     Cash       Inventory
  ---------     ---------
  10  |         10  |
      |   5         |  10
  20  |

  Inventory  
  ---------
  10  |
      |  10

   Revenue
  ---------
      | 10
What do you think the accounting equation looks like at this point? Think on it for a second.

Let's close out our accounts before answering that question.

Assets:

     Cash       Inventory  
  ---------     ---------
  10  |         10  |
      |   5         |  10
  20  |         ---------
  ---------            $0
  30  |   5     ---------
  ---------     ---------
        $25
  ---------
  ---------

 Liabilities:

     A/P   
  ---------
     |  10 
  5  |
  ---------
         $5
  ---------
  ---------
Equity:

   Revenue        Equity
  ---------     ---------
      |  10         |  10
  ---------     ---------
        $10           $10
  ---------     ---------
  ---------     ---------
At this point, the accounting equation remains perfectly balanced still:

  Assets = Liabilities + Equity
  25 = 5 + 20
From here, we could create a Balance Sheet (B/S), which is a look at the balances of our accounts at a point in time.

  ---------------
   Balance Sheet
  ---------------
  Assets:
  
  Cash         25
  Inventory     0
  ---------------
  Total       $25
  ---------------
  Liabilities:
  
  A/P           5
  ---------------
  Total        $5
  ---------------
  Net assets: $20
  ---------------
  Equity:
  
  Equity       10
  R/E          10
  ---------------
  Total       $20
We can see a shift of the accounting equation on the B/S with the net assets equaling the equity (Assets - Liabilities = Equity).

Hold on. Where did R/E come from? That stands for Retained Earnings and represents the net profit as the end of the period measure by the Income Statement (I/S). Similarly, the movement of Cash would be measured during the period in the Statement of Cash Flows (C/F) with the ending cash position flowing into the Cash balance on the B/S.

Accounting is more complex in reality of course, but I hope this provides a demonstration of how double-entry accounting works and how accountants think when performing bookkeeping functions. It's really sort of a fun practice in a geeky way. It's all about the flow of balancing things. Everything is accounted for, and these practices demonstrate how business resources are used.

Any questions?

Adapted from this blog post: https://www.winstoncooke.com/blog/2023-10-20-a-basic-introdu...

Post reply on HN