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 3221052
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:49:55+00:00 2026-05-17T15:49:55+00:00

I’ve been reading about Inversion of Control frameworks and I’m just playing around with

  • 0

I’ve been reading about Inversion of Control frameworks and I’m just playing around with the question: “Why in the hell do I need a framework to do this?”

Don’t misunderstood my question… the pattern is something we programmers use often but… a full featured framework to do that?

I must be missing something and that’s the reason I’m posting the question. I’ve seen a lot of examples on the web and I just don’t get it. mi mind is blocked to the idea maybe.

Just take a look at the Ninject Home page’s example:

public class Samurai {
    public IWeapon Weapon { get; private set; }
    public Samurai(IWeapon weapon) {
        Weapon = weapon;
    }
}

public class WarriorModule : NinjectModule {
    public override void Load() {
        Bind< IWeapon >.To< Sword >();
    }
}

The “Samurai” class is ok to me. The “NinjectModule” framework seems unnecessary to me.

I’m assuming later in the code we will be creating new “Samurai” instances passing in “Sword” instances to it, something like:

Samurai theWarrior = new Samurai(WarriorModule.GetInstance(IWeapon));//no coupling

which could be replaced by:

Samurai theWarrior = new Samurai(new Sword());//still no coupling

or

Samurai theWarrior = new Samurai(GetWeaponFromXML());//no coupling yet

What’s the part I’m missing? Could you please tell of some scenario where Ioc framework could be needed in my Application?

Thanks.

UPDATE AFTER 4 ANSWERS: I really liked all of the answers I got from you guys. I just read this post dependency-injection-dissection/ where the guy use it for Unit Testing and the StackOverflow link you just provided and Yeah, I was missing the big-big-big complexity part, so let custom myself to use a IoC framework. Thanks again.

I would vote your answers but I just get an orange message saying I can’t.

Thanks to the guy who highlighted the code I posted.

  • 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-17T15:49:55+00:00Added an answer on May 17, 2026 at 3:49 pm

    Your example is pretty straight forward having just the two layers, but when you have a real life example it soon gets messy:

    var form = new OrderEntryForm(
        new OrderService(
            new OrderReposity(
                new DatabaseGateway(
                    new DataProviderFactory()))))
    

    An IoC container can do all the wiring up for you, making your life a lot easier.

    This is an example from a similar question, which goes in to all the details:
    https://stackoverflow.com/questions/45191/ioc-explain-and-more-important-when-to-use-it/45197#45197

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have some data like this: 1 2 3 4 5 9 2 6
I need to clean up various Word 'smart' characters in user input, including but
Does anyone know how can I replace this 2 symbol below from the string

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.