Object Oriented ColdFusion | Information for Object Oriented ColdFusion development

Aug/09

23

Learning OOP: What is Dependency Injection?

In an object oriented application each object you create should have well defined and narrow focused responsibilities. Ideally in your application each of your objects should have just a single responsibility. If you have an object that performs calculations, database updates, sends emails, imports data and performs logging, then this is a good candidate for breaking down into separate objects each with more narrow focused responsibilities. However, once you have separated your objects in this way you still need a nice way of combining these separate objects so they can work together.

Dependency injection is a complicated word for a fairly simple technique of getting objects to work together. It also provides a good technique to increase the maintainability of your applications.

Continued here: Dependency Injection

2 comments

  • Christian Ready · August 23, 2009 at 9:01 pm

    Thank you for your very clear, concise Wiki article on Dependency Injection! Although it may be a little outside the scope of the article, could you explain how a framework like ColdSpring simplifies dependency injection? I ask because a number of newcomers have probably heard of ColdSpring but aren’t sure what problem it solves or how it solves this particular problem.

  • Kevan Stannard · August 23, 2009 at 9:38 pm

    Thanks Christian. Next entry for the wiki will describe writing a simple object factory and I’ll follow this with a brief introduction to ColdSpring. Actually I’ll be looking for some nice introductory tutorials for ColdSpring (and LightWire) that I can refer to, so if anyone knows of any, please leave a comment about them.

Leave a Reply

<<

>>

Theme Design by devolux.nh2.me