"Loose coupling" is not a coding issue, it's a design issue. Loose coupling simply means that individual design elements should be constructed so the amount of unnecessary information they need to know about other design elements are reduced. In short, loose coupling is a design goal that seeks to reduce the interdependencies between components of a system with the goal of reducing the risk that changes in one component will require changes in any other component.
The degree of coupling between two components can be qualitatively measured by determining the effects of changing the contract or interface between two components or systems. For example:
* What would happen if you added or deleted a property from a class?
* What would happen if you changed the data type of a column in a table?
* What would happen if you added a column to a table?
* What would happen if you changed you asynchronous email component?
* What would happen if your database server changed from SQL Server to mySQL or Oracle?
The degree of pain that each of these changes would cause you is a good qualitative measurement of how tightly coupled your components are to the components they depend on.
interface Bounceable {} class Car implements Bounceable {} class Ball implements Bounceable {} public class TestCoupling { Car c;// tight coupling Bounceable b; // loose coupling. }
With the Bounceable reference, we can have a Car instance or a Ball instance. So, the TestCoupling and the Car or Ball are loosely coupled(without the Car reference).
2 comments:
Thanks for publishing this blog, really awesome. Its help me to clarify my doubts well.
C C++ Training in Chennai
c++ course
c++ class
c c++ course fee
JMeter Training in Chennai
Appium Training in Chennai
javascript training in chennai
core java training in chennai
I really love your article a lot it is just amazing
AngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery
Post a Comment