Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Castle Windsor is an inversion of control tool. There are others like it.</p> <p>It can give you objects with pre-built and pre-wired dependencies right in there. <strong>An entire object graph created via reflection and configuration rather than the "new" operator.</strong></p> <p>Start here: <a href="http://tech.groups.yahoo.com/group/altdotnet/message/10434" rel="noreferrer">http://tech.groups.yahoo.com/group/altdotnet/message/10434</a></p> <hr> <p>Imagine you have an email sending class. EmailSender. Imagine you have another class WorkflowStepper. Inside WorkflowStepper you need to use EmailSender.</p> <p>You could always say <code>new EmailSender().Send(emailMessage);</code></p> <p>but that - the use of <code>new</code> - creates a TIGHT COUPLING that is hard to change. (this is a tiny contrived example after all)</p> <p>So what if, instead of newing this bad boy up inside WorkflowStepper, you just passed it into the constructor?</p> <p>So then whoever called it had to new up the EmailSender.</p> <p><code>new WorkflowStepper(emailSender).Step()</code></p> <p>Imagine you have hundreds of these little classes that only have one responsibility (google SRP).. and you use a few of them in WorkflowStepper:</p> <p><code>new WorkflowStepper(emailSender, alertRegistry, databaseConnection).Step()</code></p> <p>Imagine not worrying about the details of <code>EmailSender</code> when you are writing <code>WorkflowStepper</code> or <code>AlertRegistry</code></p> <p>You just worry about the concern you are working with. </p> <p>Imagine this whole graph (tree) of objects and dependencies gets wired up at RUN TIME, so that when you do this:</p> <p><code>WorkflowStepper stepper = Container.Get&lt;WorkflowStepper&gt;();</code></p> <p>you get a real deal <code>WorkflowStepper</code> with all the dependencies automatically filled in where you need them. </p> <h2>There is no <code>new</code></h2> <p>It just <em>happens</em> - because it knows what needs what. </p> <p>And you can write fewer defects with better designed, DRY code in a testable and repeatable way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload