Loose coupling is an important design principle that should be used in software applications. The main purpose of loose coupling is to strive for loosely-coupled designs between objects that interact with each other. Coupling refers to the degree of knowledge that one object has about the other object that it interacts with.
Loosely-coupled designs allow us to build flexible object-oriented systems that can handle changes because they reduce the dependency between multiple objects.
The loose coupling architecture ensures following features:
It reduces the risk that a change made within one element might create an unanticipated impact on the other elements
It simplifies testing, maintenance, and troubleshooting problems
The system can be easily broken down into definable elements
The Observer pattern provides you with an object design where the Subject
and Observer
are loosely coupled. The following points will explain this better:
The only thing that the...