Sunday, 9 August 2009

FlexBudget

I’ve spent quite a bit of time this weekend working on FlexBudget. I am pretty pleased with my progress.

I haven’t created a single view component yet b8t have just been working on the domain classes and tests.

For this sort of project TDD really comes into it’s own. As I say, I haven’t created a single view component yet but when I get to that stage I can be fairly sure that all of the domain classes will work fine – including all binding.

So far I have created the following domain Classes:

  • Account
  • AccountAdjustment
  • Transaction
  • Balance
  • Withdrawal
  • Deposit
  • Transfer

Balance, Withdrawal, Deposit and Transfer are all Transactions. Each Transaction has at least one AccountAdjustment which is associated with one account. A withdrawal has one AccountAdjustment – a withdrawal with a negative amount. A Transfer has 2 account adjustments, a withdrawal from one account and a deposit in another account.

Each account has a collection of account adjustments that are sorted by date. The balance of the account is calculated by each adjustment being passed the balance of the previous adjustment and then working out the new value.

There is quite a lot of testing to make sure that if you update the amount or date of an account adjustment the amount property on the associated transaction updates (and the binding fires) and if there are any other adjustments for that transaction that the amount updates there as well.

The next step is to create a Budget class that will hold a collection of Transactions and a Collection of Accounts. The accounts will be used to generate an array of DataGridColumns and the transactions will be used as a dataprovider.

No comments:

Post a comment