So I have started my initial design of a simple system.
I have a superclass/abstract called Customer. It has 2 subclasses: PrivateCustomer and BusinessCustomer.
I also have an account class. This account may be a downpayment account or just a regular account. It it determined by a Enum.
The Customer class has a List<> of accounts.
Now, I also have a transaction class, and this is where it gets tricky.
The transaction class has the following properties:
- Sender
- Receiver
- Amount
- Date
- Type (Enum)
As you might imagine:
A customer can have 1 or more accounts.
A customer can make 0 or more transactions.
An account has transactions (or the other way around?)
Now. Where do I place there transaction? Keep in mind, the system might have/get [insert large number] of transactions over time.
- Do I have a global list of all
transactions and simply filter the
list, when I want to see all
transaction for PrivateCustomer
12345? - Do each account property, in the
Customer class, have a list of all
transactions instead? - Something third?
As long as its an OO-solution, I will be satisfied.
Why not Sender and Receiver be references to Customer objects. Going the other way, each Customer has a List of references to Transaction objects that it is participating in. If your design will allow for a circular reference, this is the way I would go.
Something along these lines:
a revision taking into account the account information (no pun intended):