CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeffrey Palermo [MVP]

Software management consultant and CTO, Headspring Systems

StructureMap v1.1 (for .Net 2.0) released on sourceforge - level 000

Not long ago, Jeremy Miller released version 1.0 his excellent dependency injection tool, StructureMap.  I've ported it to .Net 2.0, and I've added generics to the bread and butter class, ObjectFactory.  Download the .Net 2.0 release on sourceforge.net.  StructureMap supports creating very loosely coupled applications by service location and dependency injection.

Coding to interfaces is fine and dandy, but at some point, you need an instance of the concrete class that implements the interface.  Typing "new SomeClass" tightly couples your code, so what do you do?

Slap an attribute on the interface, the concrete class, and then all you have to type is:

IMyInterface instance = ObjectFactory.GetInstance<IMyInterface>( );

That's all it takes, and you have an instance of the interface you are binding against.  Using this pattern, you can harvest reuse in your applications and test any component in isolation.



Comments

Sam Gentile said:

Again another month and change since the last one so this issue will be a collection of everything marked...
# May 17, 2006 11:30 AM

About Jeffrey Palermo

Jeffrey Palermo is a software management consultant and the CTO of Headspring Systems in Austin, TX. Jeffrey specializes in Agile coaching and helps companies double the productivity of software teams. Jeffrey is an MCSD.Net , Microsoft MVP, Certified Scrummaster, Austin .Net User Group leader, AgileAustin board member, INETA speaker, INETA Membership Mentor, Christian, husband, father, motorcyclist, Eagle Scout, U.S. Army Veteran, and Texas A&M University graduate. Check out Devlicio.us!

This Blog

Syndication