Skip to content

Latest commit

 

History

History
17 lines (16 loc) · 1.01 KB

readme.md

File metadata and controls

17 lines (16 loc) · 1.01 KB

Design Patterns Examples with Java

Strategy :

  • It's about using composition rather than inheritance
  • Strategy Pattern defines a family of algorithms, encapsulate them and make them interchangeable
  • Strategy let the algorithm vary independently of the client using it.
  • Examples at com.ridait.dps.strategy
  • UML Diagram: Strategy UML Diagram

Observer :

  • Observer Pattern defines a One-To-Many dependency between objects so that when one object changes state all of its dependent are notified and updated automatically
  • Observable (called also subject) is observed by Observers
  • addObserver(), removeObserver() and notifyObservers() are the main methods that an Observable implements
  • update() is the method inside the Observer that is called whenever an Observable try to notifyObservers()
  • Example at com.ridait.dps.observer
  • UML Diagram: Observer UML Diagram