lsp is all about well-organized & 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 interface.
-
It allows you to use behavior from a family of other classes, and to chang that behavior at the runtime.
-
When an objects 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 behavior.
Aggregation is used when one class ia used as a part of another class, yet still exists outside of that other class
- It's a variation in composition.
Aggregation VS Composition -- look at pg 430 and 431.