Inheritance-based Architecture |
COMP 310 Java Resources Eclipse Resources |
[Back to Ballworld]
Fundamental Design Principle: The Separation of the Variant from the Invariant
The Union Design Pattern separates the system into variant and invariant parts along the line between the subclasses (variant) and the superclass (invariant).
The abstract ABall represents all the invariant properties and behaviors of balls, that is, all that is common across ALL balls.
The concrete subclasses, StraightBall, CurveBall, GooglyBall, etc. ONLY contain that which makes them distinct from other balls, that is, only that which is variant.
Does the system care what kind of balls are in it?
Note that the number of adapters and the methods in those adapters depends on how you personally model the system. Your design may be different that what is shown here!
© 2020 by Stephen Wong