Skip to main content

Posts

Showing posts from June, 2017

How to implement Dependency Injection Using Ninject

When i was a little young at programming, i have always wondered, why the need for dependency injection, why the need for creating more work for yourself by creating objects and injecting it to the constructor of the dependent object, where you can instantiate the object directly from your codebase, not until i realised the importance, i’m sure some cool developer are asking some of this questions that i once asked, in this article i intend to answer some of this question and also show some quick implementation of dependency injection with Ninject. According to Wikipedia, the intent behind dependency injection is to decouple objects to the extent that no client code has to be changed simply because an object it depends on needs to be changed to a different one. The main aim here is to adopt a modular design approach, where there are lots of small blocks loosely coupled with each block knows very little about its neighbour other than how it connects to them, this approach greatly helps …