Blog

22
January 2014

Gavin Pickin

Unit Testing - Online Learning - Great way to understand Dependency Injection

Angular, Dependency Injection, Online Interactive Learning, Unit Testing

We've done a lot lately with Unit Testing, and one of the items we touched on, only briefly, in the scheme of things, was Dependency Injection, and why it is a good practice to use. We also discussed why a Dependency Injection framework like ColdBox's WireBox, Sean Corfield's DI/1 from Framework/1, and Coldspring from the XML days are a great benefit, especially as your app gained momentum and size. 

I explained it here, and although I only touched on it, I know Dependency Injection is not an easy concept to grasp, the funny thing, once you actually do it, you think to yourself, wow, thats not complicated at all. Yesterday I blogged about the great videos available online at youtube for Angulars Conference ng-conf, and one of the ones I watched about Dependency Injection was priceless... so todays post is going to discuss that video, and then let you watch the video, and everything will click (I hope).

The first thing I want to say is, although its referencing Angular, the explanation in the first part of the video is universal, and you do not need to know anything about Angular to get the full value out of it. The examples are pretty standard in Dependency Injection documentation and wiring guides, where they use a Coffee Machine as a reference. Its funny, because their model is almost identical to ColdBox's Wirebox documentation, which has been around for quite some time, although I'm sure the Angular guys do very little CFML, its cool to see the similarities with CFML Dependency Injection and something that Google Engineers for Angular are working with.

The similarities do not end there. I admit, I haven't had time to look at Sean Corfields DI/1 yet (its on my to-do list), but I have had some exposure to WireBox, and watching this video, the patterns Angular implement look very familiar, and that is obviously because the top quality engineers in cfml look to the bigger industry at large, and study the design patterns, and other implementations, when bringing Frameworks to cfml. It made me feel good about the language that we love so much, and that we have some great quality tools in place, designed in the spirit of Open Source, but up to professional grade. 

That got me thinking about things that we do, how often do we go outside the box, and look outside of our language for design patterns and solutions. Maybe next time you hit a problem... look outside and see what you can do to lift the cfml world.

Enough talk.. check out the video :)

 

 

Blog Search