Skip to content

Tag: Dependency Injection

Dependency Injection using Autofac

In the previous post, we saw how we can inject dependencies without any DI container. However, in this post, we will see how DI containers help us by instantiating the dependencies and provide them whenever and wherever required.   What is a DI Container? In the example for our last post, we had to instantiate dependencies on our own, before injecting them via constructor. Consequently, as…

Dependency Injection – without DI Container

Now that we have the answer to our question, why loosely coupled code?, let’s try and solve the problems we found in a tightly coupled application. In this post, we will use constructor based dependency injection, however, we are not going to use any DI container for now.   Dependency Injection Dependency Injection (DI) is a technique that helps us achieve loose coupling between objects and…

Implicit vs Explicit Dependencies

If our class depends upon other classes to complete its operations, then these other classes are dependencies for our class. Our class can have these dependencies as implicit or explicit dependencies. What does this mean? What effect does it have on our application design? Let’s try to find answers to these questions.   Implicit Dependencies The dependencies are implicit for a class, if they exist only in the code within…

Analyzing a Tightly Coupled Application

Dependency injection is a vast topic in itself. However, it is difficult to find everything we should know about it in one place. And so, I thought of creating my own series of learning about topic. In this part of the series we will look into a tightly coupled application and the problems related to it.   Introduction An application is said to be tightly…