Dependency Injection

Castle Windsor Tips — say NO to private setter

Now, this is some­thing that has stung me and every sin­gle one of my col­leagues time and time again.. Imag­ine you have an inter­face called IMy­Con­fig­u­ra­tion which has a get-only prop­er­ty: And the imple­ment­ing class takes in a para­me­ter called port in the con­struc­tor and sets the val­ue of the prop­er­ty using a pri­vate set­ter …

Cas­tle Wind­sor Tips — say NO to pri­vate set­terRead More »

Castle Windsor Tips — specifying IEnumerable in config file

One of the more obscure things I have had to do inside a Cas­tle con­fig is to spec­i­fy an IEnumerable<T> instance which required tak­ing the tech­nique I showed in this post a lit­tle fur­ther: I spec­i­fied the lifestyle of this IEnumerable<T> to be sin­gle­ton as in most cas­es where you would want to do some­thing …

Cas­tle Wind­sor Tips — spec­i­fy­ing IEnu­mer­able in con­fig fileRead More »

Castle Windsor Tips — specifying generic types in config file

If you have an inter­face like this: with a con­crete class like this, which you want to wire up with Cas­tle: Then here’s the syn­tax to spec­i­fy the com­po­nent in your Cas­tle Wind­sor con­fig­u­ra­tion file Sim­i­lar­ly, imag­ine if you have more than one gener­ic type para­me­ter: Remem­ber, you need to use the back tick (‘), …

Cas­tle Wind­sor Tips — spec­i­fy­ing gener­ic types in con­fig fileRead More »

Buzzword Buster — Dependency Inversion Principle

Def­i­n­i­tion: Depen­den­cy Inver­sion Prin­ci­ple refers to a spe­cif­ic form of decou­pling aimed at rend­ing high-lev­­el mod­ules inde­pen­dent of the low-lev­­el mod­ules’ imple­men­ta­tion details. Its prin­ci­ple states: High-lev­­el mod­ules should not depend on low-lev­­el mod­ules, both should depend on abstrac­tions. Abstrac­tions should not depend upon details. Details should depend upon abstrac­tions. Depen­den­cy Inver­sion Prin­ci­ple is often …

Buzz­word Buster — Depen­den­cy Inver­sion Prin­ci­pleRead More »

Buzzword Buster — IoC

Def­i­n­i­tion: Inver­sion of Con­trol (IoC) refers to the inver­sion of the flow of con­trol (the order in which indi­vid­ual state­ments, func­tion calls, etc. are exe­cut­ed) in a soft­ware. You’ll often hear the term Hol­ly­wood prin­ci­ple being men­tioned in the same breath as IoC, it sim­ply states “Don’t call us, we’ll call you” which more or …

Buzz­word Buster — IoCRead More »

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close