Appointment
date:Date
start:Time
end:Time
desc:String
Scenario
Calendar
add(Appointment):void
*
Encapsulate Type Code to Subclasses
appointments
Regular
Todo
AllDay
The user can then encapsulate the type codes of Appointment into subclasses.
Things look pretty good, until she realizes that the user of the calendar might want to change the type of an appointment.
Objects can’t change class in Java, so this creates a problem.
Here she can use Dr. Jones’ ability to explore alternatives to back up and try a different refactoring.