Dependency Injection often abbreviated as DI is a design pattern/programming technique or simply a term thrown around a lot in software development lingo. When I first encountered this term, I didn’t understand what it meant since it seemed to mean something complicated. To my surprise it is just a fancy term representing a simple concept. Before going any further let’s lay a groundwork and define some terms. Service any class that contains some useful functionality. Dependency a service (any class ) that is used by another class or function. Let’s say we have a web server with two classes: authentication class and database management class. Users can make a request to our web server to add new data or delete some data. On the server side, database management class is responsible for connecting to database and modifying the data but it relies on the authentication class to check if the user who is making the request is authenticated and has necessary privileges. For database...
Article and blogs on Technology, Everyday Life, and more