Factory Method: shipping parcels
Let subclasses decide which object to create, inside an algorithm the base class keeps.
Level Intermediate
What you will see
- Same steps, different parcels
- A switch in the middle of the steps
- The creator keeps the steps
- One method left open
- One subclass per carrier
- When not to use it
Before / after
Base: factory-method-base-tsView the diff