I created a class model for banks that has a class BankAccount
with an attribute (property) balance (among others). Also a Transaction
class, associated with BankAccount
, that stores each account transaction. After storing a transaction I always update the balance.
One of the developers that work in my company said me that having a balance attribute is not a good idea, but refused to explain why. He said it is obvious. I can't see any obvious mistake.
Calculating the balance every time I need it by processing all transactions doesn't seem smart. Am I missing something?