Dependency Injection & IoC

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    3 Favorites

    Dependency Injection & IoC - Presentation Transcript

    1. Dependency Injection & Inversion of Control Unity Application Block vs. Spring.NET Dennis Loktionov [email_address] February 2009
    2. Agenda
      • What is a Dependency?
      • Dependency Injection Pattern
      • Injection Types
      • Dependency Injection Pros & Cons
      • Spring.NET vs. MS Unity Application Block
      • References
      • Questions
    3. What is a Dependency?
      • Common Dependencies
        • Application Layers
          • -- Data Access Layer
          • -- Business Layer
          • -- Presentation Layer
        • External Services
          • -- Web Services
          • -- WCF Services
        • External Components
          • -- Frameworks & Libraries
          • -- 3 rd Party Components
    4. Application Layers Dependencies
    5. Why dependencies are evil?
      • Problems that dependencies create
        • Tight coupling of software components
        • Software becomes hard to maintain
        • Difficult to isolate when testing
    6. Dependency Injection Pattern
      • WHAT
      • Dependency Injection (DI) in computer programming refers to the process of supplying an external dependency to a software component or service.
      • WHY
        • Ability to specify component dependencies at run time
        • Simplified management of cross-cutting concerns
        • Increased testability of individual components
        • Need for pluggable architecture
    7. Dependency Injection Types
      • Types of Dependency Injection
        • Constructor Injection
        • Property (Setter) Injection
        • Method Call Injection
    8. Dependency Injection Types
      • Constructor Injection
    9. Dependency Injection Types
      • Property (Setter) Injection
    10. Dependency Injection Types
      • Method Call Injection
    11. Dependency Injection Pros & Cons
      • Pros
        • Loosely Coupled & Highly Cohesive
        • Increased Testability & Maintainability
        • Flexibility of run time configuration
        • Inversion of Control containers do the wiring for you
      • Cons
        • Increased code complexity
        • Can complicate debugging during the learning curve
        • Code flow becomes not trivial
    12. Inversion of Control
      • Dependency Inversion Principle (DIP)
        • The principle states that high level or low level modules should not depend upon each other, instead they should depend upon abstractions.
      • Specific implementation (object instances) are deferred to a higher level of abstraction control.
        • Parent Classes
        • Container
    13. Frameworks
      • Frameworks
        • Spring.NET
        • MS Unity Application Block
        • Castle Windsor
        • StructureMap
        • Ninject
        • PicoContainer.NET
        • … and many more
    14. Spring.NET
        • Spring.NET Architecture
    15. Spring.NET
        • Inversion of Control Container in Action
    16. Spring.NET: code samples
        • Movie Lister example
    17. MS Unity Application Block
        • Unity Application Block Architecture
    18. Unity: code samples
        • Movie Lister example
        • Quick start web example
    19. Dependency Injection Pitfalls
        • Circular References
          • Objects generated though constructor injection that reference each other in their constructor parameters
          • Objects generated though constructor injection that pass a reference of their type in constructor
          • Objects generated though method call injection that reference each other
          • Objects generated though property injection that reference each other
        • Partial Trust Environment Limitations
    20. References
      • Useful links:
      • http://martinfowler.com/articles/injection.html
      • http://www.springframework.net/
      • http://www.codeplex.com/unity
    21. THANKS
    22. Questions ? Dennis Loktionov [email_address] 604-628-5100 ext .356
    SlideShare Zeitgeist 2009

    + Dennis LoktionovDennis Loktionov Nominate

    custom

    1232 views, 3 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 1232
      • 1232 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 3
    • Downloads 0
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories