“A change to the system that leaves its behavior unchanged, but enhances some nonfunctional quality – simplicity, flexibility, understandability, performance” Kent Beck, Extreme Programming Explained
“A change made to internal structure of software to make it easier to understand and modify without changing its observable behavior.” Martin Fowler, Refactoring
When you find you have to add a feature to a program, and the program's code is not structured in a convenient way to add the feature, first refactor the program to make it easy to add the feature, then add the feature. Tip
After extraction and movement of the frequent renter points calculation Customer Movie 1 * 1 * statement() daysRented: int Rental priceCode: int getCharge() getFrequentRenterPoints()
Price getCharge Regular Price getCharge Childrens Price getCharge New Release Movie getCharge Movie getCharge return price->getCharge() Using the State pattern [GoF] on movie