In my last post - see What is

Castle of Windsor

Castle Windsor is an inversion of control tool. There are others like it.

It can give you objects with pre-built and pre-wired dependencies right in there. An entire object graph created via reflection and configuration rather than the "new" operator.

Start here:

Imagine you have an email sending class. EmailSender. Imagine you have another class WorkflowStepper. Inside WorkflowStepper you need to use EmailSender.

You could always say new EmailSender.Send(emailMessage);

but that - the use of new - creates a TIGHT COUPLING that is hard to change. (this is a tiny contrived example after all)

So what if, instead of newing this bad boy up inside WorkflowStepper, you just passed it into the constructor?

So then whoever called it had to new up the EmailSender.

new WorkflowStepper(emailSender).Step

Imagine you have hundreds of these little classes that only have one responsibility (google SRP).. and you use a few of them in WorkflowStepper:

new WorkflowStepper(emailSender, alertRegistry, databaseConnection).Step

Imagine not worrying about the details of EmailSender when you are writing WorkflowStepper or AlertRegistry

You just worry about the concern you are working with.

Imagine this whole graph (tree) of objects and dependencies gets wired up at RUN TIME, so that when you do this:

WorkflowStepper stepper = Container.Get;

you get a real deal WorkflowStepper with all the dependencies automatically filled in where you need them.

Source: stackoverflow.com
Video on topic: Castle of Windsor
Windsor Castle Concours of Elegance (The Concours of
Windsor Castle Concours of Elegance (The Concours of ...
Anniversary of Windsor Castle fire
Anniversary of Windsor Castle fire
Changing of the Guard, Windsor Castle - April 2009 - PART ONE
Changing of the Guard, Windsor Castle - April 2009 - PART ONE

Interesting facts
Share this Post

Related posts

Castle Official website

Castle Official website

JULY 08, 2020

Nagoya Castle was constructed on the orders of Ieyasu TOKUGAWA in order to secure an important position on the Tokaido road…

Read More
Windsor Tourist attractions

Windsor Tourist attractions

JULY 08, 2020

By LoriPori Helpfulness Over 40 of the area s finest heritage buildings open their doors for FREE public tours. Explore national…

Read More