This is what helped me when I learned. Hollywood principle. You don't call us, we'll call you! You don't create object, you inject it. Instead of creating an object, you create the dependency between the classes. So that, the client who is going to use the class will have control over what implementation to use, rather than tie it up with one implementation. Is that clear enough?
Rajkumar
Fullstack Developer.
This is what helped me when I learned. Hollywood principle. You don't call us, we'll call you! You don't create object, you inject it. Instead of creating an object, you create the dependency between the classes. So that, the client who is going to use the class will have control over what implementation to use, rather than tie it up with one implementation. Is that clear enough?