Sunday, January 25, 2009

Rupiz: A basic design

What do we need for the back end of a personal finance application?

  • Some way to represent Accounts. An Account has a description, current balance, and some methods to modify the current balance.

  • We want to encapsulate modifications to accounts in Transactions, which would have a description, source account, destination account, and amount. In addition, we will want a version of Transaction that holds a number of subtransactions.

  • We want users of our Account class to not care how the account is implemented (in particular how the current balance is represented). To make this possible, we will define an Amount interface to hide these details. To start, we will use an implementation that uses BigDecimal to hold the amount info. If we want to change this later, we can do so easily and without a lot of search-and-replacing.


So for our model, we will have an Account class that holds a BigDecimal for the current balance. This Account will have methods deposit(Amount) and withdraw(Amount) that both return an implementation of Amount representing the updated account balance. To track our account balance changes, we will have a Transaction interface with implementations BasicTransaction and CompoundTransaction, where CompoundTransaction will allow us to group a number of transactions together. We will maintain a List<Transaction> for each account we're dealing with.

For our GUI, we will need a way to show our list of Transactions for a given account. A JTable will do nicely until we add support for compound transactions. Our JTable will need columns for Date, Description, Transaction Type, Source/Destination, Amount, and whether the transaction has been reconciled.

A new year, a new project

Happy new year! I figured this year I'd resolve to finish a programming project that's been kicking around the back of my head for a while now and has had an abortive start or two.

For the past year, I've been using GnuCash as my way of keeping track of my spending. While it's a very well written program, it has one minor irritant. I split my purchases into categories to better track where my money goes, but that makes reconciliation tricky at the end of the month. While I could preface the description for each transaction with the store, I'd rather be able to group transactions and be able to treat the group as a whole as a single entity during reconciliation.

So, with no pomp and somewhat random circumstance, I will be using this blog as a way to guilt me into working on a personal finance app I'm going to call Rupiz (Roo-peez).