Contents tagged with dependencies

  • A Gentle Introduction to StructureMap

    I found myself explaining inversion of control containers and their benefits to someone today, and so I created a very simple console application that makes use of StructureMap (my favorite such container).  You can view the whole file in this Gist.  Here I’ll just briefly explain what’s going on. The main benefit of a tool like StructureMap is to decouple your classes from their collaborators.  Rather than classes knowing exactly which implementations they’re working with, they publish their needs for collaborators in their constructors, providing explicit dependencies (see my other posts on dependencies).  The IoC container then is used to provide these classes with the … more

  • New is Glue

    When you’re working in a strongly typed language like C# or Visual Basic, instantiating an object is done with the new keyword.  It’s important that we recognize the significance of using this keyword in our code, because I would venture to say that well over 90% of developers don’t give it a second thought.  Most developers have, at one time or another, heard the practice of building software applications likened to building something out of LEGO bricks (I’ve even written about LEGOs and software in the past).  A few days ago, it occurred to me that I could sum up my thoughts on this topic in three words, which I might hope would be memorable enough to “stick” in developers’ … more