15 Min 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

    Favorites, Groups & Events

    15 Min IoC - Presentation Transcript

    1. 15 minutes IoC
    2. The Constructor Problem class A {     private B _b;     public A() { _b = new B(); } }
    3. Dependency to the concrete class B if B changes the constructor A must change as well if B becomes new dependencies, e.g. B(C, D),  A must create these dependencies as well if C, D of B have their own dependencies, e.g. C(E), D (F),  A must create them too...
    4. A is a 'factory' of Bs A influences the count created instances of type B  could be partially solved by the MonoState Pattern
    5. ServiceLocator: temporary solution     class A {         private B _b;         public A(ServiceLocator locator) {              _b = locator.get(B.class);          }     }
    6. ServiceLocator problems extra dependency to the ServiceLocator 'push vs pull':we ask for a service, instead of just getting the service standard API across several libraries:  MyServiceLocator vs YourServiceLocator
    7. but A needs *only* the services provided by B,  ... e.g. the interface IB         class A {         private IB _b;         public A(IB b) { _b = b; }     }
    8. Classes as puzzle pieces  class A implements IA {         private IB _b;         public A(IB b) {             _b = b;          }     }   in -> required services: IB out <- provided services: IA
    9. IoC Container: puzzle table
    10. Flavors Required services declared/injected on field setter constructor method (e.g. init(...)) Wiring automatic manual: xml, JavaConfig, ...
    11. References Gilad Bracha: Constructors Considered Harmful  Lethal Injection Martin Fowler: IoC Containers & DI   Guice  2 min. Pico  my delicious ioc   Pictures: http://www.flickr.com/photos/joeyday/147651531/  http://www.flickr.com/photos/jowo/20840165/   http://commons.wikimedia.org/wiki/File:Iceberg_4_1997_08_07.jpg 
    SlideShare Zeitgeist 2009

    + andrei.pamulaandrei.pamula Nominate

    custom

    327 views, 0 favs, 1 embeds more stats

    Short (15min) introduction to IoC principles

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 327
      • 319 on SlideShare
      • 8 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 1
    Most viewed embeds
    • 8 views on http://thought-tracker.blogspot.com

    more

    All embeds
    • 8 views on http://thought-tracker.blogspot.com

    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

    Tags