rowidanagah / Head_First_Object_Oriented_Design_and_Analysis

This is a code implementation for the Head-First oop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ch 8


The Liskov substitution Principle lsp

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

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

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.

About

This is a code implementation for the Head-First oop


Languages

Language:Python 100.0%