• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Dependency Injection vs Service Locator - Best Practice
 

Dependency Injection vs Service Locator - Best Practice

on

  • 5,590 views

Lars-Erik Kindblad presentation at the Capgemini Microsoft User Group 2012.

Lars-Erik Kindblad presentation at the Capgemini Microsoft User Group 2012.

Statistics

Views

Total Views
5,590
Views on SlideShare
5,164
Embed Views
426

Actions

Likes
3
Downloads
87
Comments
0

8 Embeds 426

http://www.kindblad.com 258
http://lkindblad.blogspot.no 68
http://blog.bitlinkit.com 48
http://lkindblad.blogspot.com 47
https://twitter.com 2
http://translate.googleusercontent.com 1
http://www.linkedin.com 1
http://www.docshut.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Dependency Injection vs Service Locator - Best Practice Dependency Injection vs Service Locator - Best Practice Presentation Transcript

    • Dependency Injection vs. Service Locator - Best PracticeLars-Erik KindbladSenior ConsultantBlog: kindblad.com
    • Agenda Intro • Inversion of Control • Dependency Injection Patterns • Service Locator Patterns • Inversion of Control Containers Best Practice • What patterns to use • When to use the patterns Summary | Sector, Alliance, Offering
    • Inversion of Control Inversion of Control = IOC Make code loosely coupled Make unit testing possible How? Move creation of dependencies outside the class they are being used in A better name - Inversion of Dependency Creation | Sector, Alliance, Offering
    • Traditional CodeInversion of Control | Sector, Alliance, Offering
    • Traditional CodeInversion of Control Code | Sector, Alliance, Offering
    • Traditional Code | Sector, Alliance, Offering
    • Dependency Injection - Constructor Injection | Sector, Alliance, Offering
    • Dependency Injection - Interface Injection | Sector, Alliance, Offering
    • Dependency Injection - Setter Injection | Sector, Alliance, Offering
    • Static Service Locator | Sector, Alliance, Offering
    • Injected Service Locator | Sector, Alliance, Offering
    • Inversion of Control Container A framework that can automatically create a given type with all the required dependencies Popular frameworks • Unity • Castle Windsor • Ninject • StructureMap • etc. | Sector, Alliance, Offering
    • Inversion of Control Container Manual approach Using an IOC Container | Sector, Alliance, Offering
    • | Sector, Alliance, Offering
    • Which patterns to use
    • Traditional Code | Sector, Alliance, Offering
    • Dependency Injection - Constructor Injection | Sector, Alliance, Offering
    • Dependency Injection - Interface Injection | Sector, Alliance, Offering
    • Dependency Injection - Setter Injection | Sector, Alliance, Offering
    • Static Service Locator | Sector, Alliance, Offering
    • Injected Service Locator | Sector, Alliance, Offering
    • When to use which patterns | Sector, Alliance, Offering
    • Always use Dependency Injection – Constructor Injection ...except | Sector, Alliance, Offering
    • FACADE CLASSES | Sector, Alliance, Offering
    • Facade Classes | Sector, Alliance, Offering
    • Dependency Injection | Sector, Alliance, Offering
    • Service Locator | Sector, Alliance, Offering
    • LOOPS | Sector, Alliance, Offering
    • Loops | Sector, Alliance, Offering
    • Dependency Injection | Sector, Alliance, Offering
    • Service Locator | Sector, Alliance, Offering
    • Dependency Injection using Func<> | Sector, Alliance, Offering
    • BASE CLASSES | Sector, Alliance, Offering
    • Base Classes | Sector, Alliance, Offering
    • Dependency Injection | Sector, Alliance, Offering
    • Service Locator | Sector, Alliance, Offering
    • UNKNOWN TYPES AT COMPILE TIME | Sector, Alliance, Offering
    • Unknown types at compile time | Sector, Alliance, Offering
    • Service Locator | Sector, Alliance, Offering
    • Summary Constructor Injection Injected Service LocatorFacade classes X(WCF Services,MVC Controllers)Loops X (Func<>) XBase classes XUnknown types at Xcompile timeAll other scenarios X | Sector, Alliance, Offering
    • QUESTIONS? | Sector, Alliance, Offering
    • www.capgemini.comThe information contained in this presentation is proprietary. ©2010 Capgemini. All rights reserved