DESIGN PATTERNS
s/w design
 What is s/w design?
 Bad design?
 Good design?

 How to approach?
Design Patterns
 What ???
&
 Why???
Patterns of our concern
OBSERVER PATTERN

IOC PATTERN
OBSERVER PATTERN
Observer pattern
 One to many dependency between objects.

 When an object changes state , all its
dependencies are noti...
Example
Participants
Subject(stock)
• Knows the list of investors.
• Provides methods for attaching , detaching and notif...
Observer
• Interface for objects that is to be notified with the changes of
subject.

Concrete observer
• Update the obs...
IOC
DI principle
• High level module should not depend on low level
modules . Both should depend on abstraction.

• Abstractio...
Dependency inversion
principle

IOC

Service Locator

Dependency
Injection
IOC
• A design pattern based on DIP

• Inverting the control so that lower module does not control the interface
and objec...
DI
• Specialization of IOC.
• Helps to make loosely coupled code.
• Increase extensibility and maintainability.
• The Depe...
Service Locator
• The Service Locator pattern introduces a locator
object that objects is used to resolve dependencies
mea...
References
•

http://satoricode.net/2011/10/01/UnderstandingTheBenefitsOfADependencyInjec
tionContainerIOC.aspx

•

http:/...
THANK YOU
Upcoming SlideShare
Loading in …5
×

Design patterns[observer and ioc]

522 views

Published on

Published in: Design, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
522
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Design patterns[observer and ioc]

  1. 1. DESIGN PATTERNS
  2. 2. s/w design  What is s/w design?  Bad design?  Good design?  How to approach?
  3. 3. Design Patterns  What ??? &  Why???
  4. 4. Patterns of our concern OBSERVER PATTERN IOC PATTERN
  5. 5. OBSERVER PATTERN
  6. 6. Observer pattern  One to many dependency between objects.  When an object changes state , all its dependencies are notified and updated.
  7. 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. 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.
  9. 9. IOC
  10. 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.
  11. 11. Dependency inversion principle IOC Service Locator Dependency Injection
  12. 12. IOC • A design pattern based on DIP • Inverting the control so that lower module does not control the interface and object creation.
  13. 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. 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.
  15. 15. References • http://satoricode.net/2011/10/01/UnderstandingTheBenefitsOfADependencyInjec tionContainerIOC.aspx • http://www.oodesign.com/dependency-inversion-principle.html • http://www.dofactory.com/Patterns/Patterns.aspx • http://www.dotnet-tricks.com/Tutorial/dependencyinjection/bSVa100413Understanding-Inversion-of-Control,-Dependency-Injection-and-ServiceLocator.html • http://martinfowler.com/articles/injection.html
  16. 16. THANK YOU

×