6. Observer pattern
One to many dependency between objects.
When an object changes state , all its
dependencies are notified and updated.
7. Example
Participants
Subject(stock)
• Knows the list of investors.
• Provides methods for attaching , detaching and notifying
observers.
Concrete subject(RM)
• Stores the state of interest to observers.
• Notifies observer when state changes.
8. Observer
• Interface for objects that is to be notified with the changes of
subject.
Concrete observer
• Update the observer with the subject.
• Maintains a reference to the concrete subject object.
10. DI principle
• High level module should not depend on low level
modules . Both should depend on abstraction.
• Abstraction should not depend on details . Details
should depend on abstraction.
12. IOC
• A design pattern based on DIP
• Inverting the control so that lower module does not control the interface
and object creation.
13. DI
• Specialization of IOC.
• Helps to make loosely coupled code.
• Increase extensibility and maintainability.
• The Dependency Injection pattern uses a builder
object to initialize objects and provide the required
dependencies to the object means it allows you to
"inject" a dependency from outside the class.
14. Service Locator
• The Service Locator pattern introduces a locator
object that objects is used to resolve dependencies
means it allows you to "resolve" a dependency
within a class.