Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8467229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:34:56+00:00 2026-06-10T15:34:56+00:00

When will you use dependency injection? Is there any overwhelming benefit of using dependency

  • 0

When will you use dependency injection? Is there any overwhelming benefit of using dependency injection?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:34:57+00:00Added an answer on June 10, 2026 at 3:34 pm

    Fowler has good comparision between the two in his Inversion of Control Containers and the Dependency Injection pattern Heading. In his concluding thoughts, he says

    Dependency Injection is a useful alternative to Service Locator. When
    building application classes the two are roughly equivalent, but I
    think Service Locator has a slight edge due to its more
    straightforward behavior. However if you are building classes to be
    used in multiple applications then Dependency Injection is a better
    choice.

    You can find more view points and comparisons in here

    For DI:

    • Easier to determine what dependencies a component has – look at
      constructor.
    • Component does not have dependency on Service Locator so
      there is not a problem if the component is used with a different
      framework.
    • DI may make testing easier but a good Service Locator
      mechanism will make stubbing equally feasible

    Against DI:

    • Harder to debug and understand.
    • Component cannot request extra services from injector once it had been configured.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to use Property Injection in Ninject 2 without using the
When using dependency injection (DI) and inversion of control (IoC) objects will typically have
I have a system which is using Spring for dependency injection. I use annotation-based
I want to use dependency injection (Unity) and at the moment I'm thinking about
Simplified Architecture of Web Projects WAR spring dependency injection (most use XML) JAR DAO
Firstly, I'm starting to use StructureMap, but an example in any DI framework will
I'd like to use a dependency injection framework . During my evaluation I came
I'm trying to understand the best way to use Spring (for dependency injection) with
When we use a dependency injection container, ideally we pull only a single-top level
I have a project that is using CQRS and Dependency Injection. The Query side

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.