Description
Learning Objectives
Refactor according to coding guidelines and provide a better design without modifying the functionality
Requirements
- Factory Pattern Add class DuckFactory to the simulator. The duck factory should handle the creation of all ducks. It will have a method called createDuck
- Adapter Pattern – Write an adapter called GooseDuck
- Observer Pattern – Use the Java Observable class and Observer interface to implement the observer pattern. The duck factory will be the subject (observable) and the duck will be the potential observers.
- Decorator Pattern – Add an abstract decorator class Bling to ducks. You should have 3 types of bling represented by the following classes: StarBling, MoonBling, and CrossBling.
- Strategy Pattern – Use the Strategy Pattern to encapsulate flying behavior and quacking behavior.