Skip to content

rowidanagah/Head_First_Object_Oriented_Design_and_Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ch 8


The Liskov substitution Principle lsp

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

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

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.

About

This is a code implementation for the Head-First oop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages