Is there a hypernym for debit/credit?

Solution 1:

I don't believe there's a single word that fits your request. In the ERP systems I've had access to, it's generally been referred to as Transaction Type (or Distribution Type, for AR and AP).

Solution 2:

As Hellion suggested, I'd use the variable name transactionType.

I've worked as a programmer on some accounting-related projects. In a nutshell, an accounting application is a log of transactions, and each transaction has a type. There may be more types than just credit and debit, however. For example, in my programs there is often a void transaction type. And if you are accepting credit cards there are transaction types specific to a credit card, such as authorization and capture, to name two.

Solution 3:

transactionDirection could work to indicate which way the money is flowing

As for variable names, camelCaseNamingStyle or underscored_naming_style in most language. I don't believe I've seen hyphens used for user-defined terms anywhere except Scheme/Lisp.

Solution 4:

Personally, I feel that "type" is almost never the best choice for a variable name (or a column label, descriptive text, etc.). Too many things can be covered by "type". It would be almost as bad as having variable names like "thing" or "stuff". So I applaud your instinct to try to find something better.

One strategy in naming a variable to hold a binary choice is to just pick one of them. Say you call it "credit". If the transaction is a credit, the variable is True, 1, or 'Y'. If it's not, it's False, 0, or 'N'. (Or, if your variable is holding the amount, make it signed and test whether the value is positive or negative. That is, the sign serves as your "transaction type" indicator.)

If you have more than two transaction types, then of course this doesn't work too well.

Solution 5:

Side: Which side (debit or credit) of the ledger would this entry have been written on back in the days of pen and paper bookkeeping? (Don't ask me which is right or left -- I always have to look that up.)

Edit: "Side" was my own solution to essentially the same programming problem. I've never seen it used by anybody else.