Inversion of Control Containers and the Dependency Injection pattern – Martin Fowler’s seminal article

In CF & Java, Frameworks, OOP by bchesley6 Comments

Separating Configuration from Use

The important issue in all of this is to ensure that the configuration of services is separated from their use. Indeed this is a fundamental design principle that sits with the separation of interfaces from implementation. It’s something we see within an object-oriented program when conditional logic decides which class to instantiate, and then future evaluations of that conditional are done through polymorphism rather than through duplicated conditional code.

If this separation is useful within a single code base, it’s especially vital when you’re using foreign elements such as components and services. The first question is whether you wish to defer the choice of implementation class to particular deployments. If so you need to use some implementation of plugin. Once you are using plugins then it’s essential that the assembly of the plugins is done separately from the rest of the application so that you can substitute different configurations easily for different deployments. How you achieve this is secondary. This configuration mechanism can either configure a service locator, or use injection to configure objects directly.

via Inversion of Control Containers and the Dependency Injection pattern.

Comments

  1. Greetings! Is it OK that I go a bit off topic? I am trying to read your site on my Mac but it doesn’t display properly, do you have any suggestions? Thanks for the help I hope! Jacinda

    1. Jacinda – I also use Macintosh (Safari, Firefox and Chrome browsers) don’t seem to have any problems? The site is built on WordPress.com and should be very clean from a web standards perspective. If you are using a different browser I would be curious to know which one (and version please). Thanks for visiting.

Leave a Comment