Thursday, June 21, 2012

An Inversion of Control Container in Dojo Javascript Framework



A year since my last article was published! I just opened my account for this year's articles yesterday. My article An Inversion of Control Container in Dojo Javascript framework got published in DZone.

Inversion of Control (IoC) / Dependency Injection (DI) has become a very popular design and architectural standard in enterprise programming. Conceptually it enables a container to manage the lifecycle and dependencies between objects - something which need not be purely exclusive to server-side enterprise development. In fact, loosely typed languages like JavaScript could be far more amenable to this concept as they obviate the need for reflection mechanisms for injecting and resolving dependencies. This article demonstrates how a simple Inversion of Control (IoC)/ Dependency Injection container can be easily prepared with JavaScript. Owing to the author's experience, the article uses Dojo framework, but it should be possible to do so using other object-oriented JavaScript frameworks or plain Javascript. The existence of open source JavaScript DI frameworks like Wire.js and Squirrel IOC are testimonial to the fact that IoC / DI is being seriously considered in the JavaScript community. This article seeks to demonstrate the design under the hood to make IoC or DI possible, the benefits of wiring using dependency injection and encourage its adoption with JavaScript application developers. It does so by walking through a code sample.

Read the full post at any of these DZone links - 

http://java.dzone.com/articles/inversion-control-container
http://architects.dzone.com/articles/inversion-control-container
http://css.dzone.com/articles/inversion-control-container