lsp is all about well-orginized & well-designed inheritance. when you inherit from a base class, you must be able to substitute your subclass.
-
It's all about substitution.
-
LSP reveals problems about inheritance.
Composition is most powerful when you want to use behavior to be defined in an interfance.
-
It allowyou to use behavior from a family of other classes, and to chane that behavior at the runtime.
-
When an objectis composed of other objects and that owing object is destroyed, the obj that are pert of the composition go away too.
-
Composition is about ownership. the main obj owns the composed bevavior.
Aggregation is used when one class ia used as a part of aanother class, yet still exists outside of that other class
- It's a variation in composition.
Aggregation VS Composition -- look at pg 430 and 431.