####Group: cw272,wj43
-
What methods would make sense as behaviors of a Bet hierarchy (i.e., make bets open to extension)?
The method of outputing the information before the player plays this round.(function placeBet()).
The method of judging whether the player wins or not in this round in different rules(function judgeWin(Wheel wheel)).
Because all of these methods will vary from method to method.If we create new rule , output and input.The type of bet will be totally different. -
What methods would help improve the code in the Game's methods (i.e., close it to modification)?
We made some abstract methods in bet class,which can be implemented by its derived class.These methods can reduce the condition , switch sentences and for loop. -
What methods can be completely implemented in the Bet super-class (i.e., are common across the hierarchy), and which completely in the Bet sub-classes (i.e., vary across the hierarchy)?
The methods of getOdd and getDescription can be implemented in super-class . Moreover , we create two functions of input the choice the gambler makes this round and caculating the amount of money he wins or loses.These are in the based class.
The judging rule and the function of recieving the choice should be in the sub class. -
How should the Game class create the correct Bet subclass?
By creating the bet list containing all kinds of bets at the very beginning of the Game initialization.
###Add New Features
- In what ways is the refactored code simpler?
If we add a new kind of bet ,we just need to modify very little part of game class. - In what ways is the refactored code more complex?
Every new feature needs a new class. - What trade-offs did you make when refactoring your old code?
No trade-off. - Which code do you prefer and why?
I think the refactored one is better.Because there is less dependency. We doesn't need to modify the majority of code when we add a new feature.It is easier to do the extention.