Expense Calculator - Session 1
My first session.
The following was achieved:
Steps: Write junit test case, it fails. Write code so test passes.
Classes: Transaction, ExpenseSheet, ExpenseLine, Money, Party.
Observations:
Steps: Write junit test method, it fails, then write code to make it pass
Classes: Transaction, ExpenseSheet, ExpenseLine, Money, Party, NonParticipantPayer->Party, Receiver->Party
Observations:
Current Class Diagram is [Click on the picture to see enlarged]:
The following was achieved:
- Set up of intellij idea
- Requriements 1 and 2
Steps: Write junit test case, it fails. Write code so test passes.
Classes: Transaction, ExpenseSheet, ExpenseLine, Money, Party.
Observations:
- process method in Transaction generates Expense sheet. Has if statements to find out if Party is payer / receiver and then calculate. Smell of Party heirarchy
- other classes have relatively no behavior.
- decision: for this requirement its good enuf but when moving to other requirements i will have to wear my refacotring hat before implemetnation
Steps: Write junit test method, it fails, then write code to make it pass
Classes: Transaction, ExpenseSheet, ExpenseLine, Money, Party, NonParticipantPayer->Party, Receiver->Party
Observations:
- Refactored Transaction , Party classes to distribute behavior of ExpenseSheet generation
- Heirarchy of Party created. Expense lines generation delegated to Party without conditional processing (claps)
- Transactions for above 2 requirements are equitable and non equitable. But they can change at run time. So I need to use State pattern. Havent done the refactoring. But its necessary though as of now only getEqualParts method has conditional processing. Thus this forms my next refactoring before I move on for the next requirement implementation
- Add more behavior into money class. Something like 5USd 3 times is 15USD should be done by money class. will make Party expense cacls simpler
Current Class Diagram is [Click on the picture to see enlarged]:
Post a Comment