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

  • Home
  • SEARCH
  • 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 329331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:34:42+00:00 2026-05-12T09:34:42+00:00

I have been reading up on Dependency Injection frameworks. I really fell in love

  • 0

I have been reading up on Dependency Injection frameworks. I really fell in love with the idea of separating the concerns and letting the objects do their core work – which is undoubtedly an excellent and long-standing design principle!

However the more I read on DI frameworks, the more I get worried:
1) In the way they “automagically” resolve dependencies
2) About the extreme complexities being introduced in the configuration files

On just the point #2, I have seen my customers spend millions of dollars to train the people on products of which the significant part was how “not” to touch config files. The administrators are now dreading these config files.

Nevertheless, I see another pattern called Service Locators where I could nicely assemble all the “global” services that I want at the start of my application (may be an application host or app context or whatever). Make this service locator globally available and voila!

However I see that there will be less flexibility when using the Service Locator approach when I need more than one type of “global” service based on some criterion (known to whom?)!

So, here I am more confused than before on which direction to take. Though I like the design principle very much, the complexity in the existing frameworks are throwing me off!

Are my concerns genuine? Anybody else feel the same? If so, is there any good alternative for such massively overwhelming “frameworks”?

  • 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-05-12T09:34:42+00:00Added an answer on May 12, 2026 at 9:34 am

    As Nate mentioned, the “magic” is optional; you can configure everything by hand if you want.

    I’d avoid the configuration files initially (or forever!) and configure the container in code. That tends to be much easier to read and maintain. Much of the time you don’t need on-the-fly changes to configuration. Customers can’t touch the configuration files because they don’t exist.

    Service locators have downsides; for one, they tend to couple your classes to the locator class/framework. A good DI framework will let you use Plain Old Objects; you may only have a single class in your project that actually uses the DI/IoC framework.

    StructureMap and Unity are both pretty simple; give them a try. Start small.

    Here’s a really simple example with Unity (including inline configuration):

    using Microsoft.Practices.Unity;
    
    static void Main()
    {
        using (IUnityContainer container = new UnityContainer())
        {
            container.RegisterType<IRobot, MrRoboto>();
    
            Console.WriteLine("Asking Unity container to give us a Model...");
    
            Model model = container.Resolve<Model>();
            model.MoveRobot();
        }
    }
    
    // class Model
    
    public Model(IRobot robot)
    {
        // Unity will hand the constructor an instance of MrRoboto!
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 254k
  • Answers 254k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer ID's should be unique on the page, when you have… May 13, 2026 at 10:07 am
  • Editorial Team
    Editorial Team added an answer You can wrap the user32.dll, I got the general idea… May 13, 2026 at 10:07 am
  • Editorial Team
    Editorial Team added an answer Thus, it's essentially a webserver serving HTML pages? You could… May 13, 2026 at 10:07 am

Related Questions

I've been reading a few things about ASP.NET MVC, SOLID and so on, and
Reading through the existing unit testing related threads here on Stack Overflow, I couldn't
I have been reading Yahoo's Best Practices For Speeding Up Your Website , but
Can anyone recommend any good material that seeks to provide a real world perspective

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.