Loose coupling through the dependency injection

Coupling is the degree of knowledge one class has about the other class. When a class is less dependent on the design of any other class, it will be called loosely coupled. Loose coupling can be best achieved by interface programming. In the Spring Framework, we can keep the dependencies of the class separated from the code in a separate configuration file. Using the interfaces and dependency injection techniques provided by Spring, developers can write loosely-coupled code. (Don't worry; very soon, we will discuss dependency injection and how to achieve it.) With the help of loose coupling, one can write a code that needs a frequent change due to the change in the dependency it has. It makes the application more flexible and maintainable.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.182.45