Skip to content

mikewangmax/DesignPatternDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Main content

Concept of object-orient wisdom

Examples for design pattern

To understand design pattern, the best way is to practice many examples.

1. What is OO principles?

  • Separation of concerns
  • Keep related data and behaviour together
  • Information hiding
  • Cohesion good, coupling bad
  • Program to the interface, not the implementation
  • Encapsulate that which varies
  • Hide your decisions
  • Make stable abstractions
  • Make your system open for extension but closed for modification
  • Do not over-engineer your solution
  • If it can change, it ain't inheritance
  • Favour composition over inheritance
  • Inheritance isn't dynamic

2. What is the dark side of inheritance?

  • Inheritance for implementation
  • Is a role of
  • Becomes
  • Over-specialisation
  • Violating the LSP
  • Changing the super class contract

3. What is the SOLOD

  • S: Single responsibility
  • O: Open-closed principle
  • L: Liskov substitution principle
  • I: Interface segregation principle
  • D: Dependency inversion

4. What is the contract?

  • Preconditions
  • Postconditions
  • Invariant

5. which design pattern will this project cover?

  • Singleton
  • Factory
  • Observer
  • Composite
  • Decorator
  • Template
  • Command

6. Book and course recommend

About

This is the sample code for <Head first design pattern>

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages