Inversion of Control (IoC) is a programming technique in which object coupling is bound at runtime by an assembler object and is typically not known at compile time using static analysis. IoC can be achieved using dependency injection. We can say that IoC is the idea and dependency injection is its implementation. Now, what is dependency injection? Let's find out.
Dependency injection is a technique where one component supplies dependencies for another component during the instantiation time. The definition sounds confusing, right? Let's explain it with an example. Consider the following interfaces:
interface Employee { fun executeTask() } interface Task { fun execute() }
A common implementation of the preceding ...