Moving Forward: Writing Extensible Software

Moral 1: Java programs are not inherently extensible. Java makes it easy to add new classes, but adding new functionality via methods isn’t easy if some of those methods have to instantiate new classes (a common pattern in many languges).

Moral 2: If you want to Java programs to be extensible, you have to design extensibility in from the beginning.

How would you have redesigned the original classes (in the starter file we provided) to make this example work? Think about it for a few minutes, then start studying the Factory Pattern. If you have time, redo the entire sequence using the Factory Pattern.