Explain Coupling

Coupling: Coupling occurs whenever classes are aware of each of other as their instances should interact. The linkage between two classes which might be either weak or strong. Stronger coupling occurs whenever one class has a thorough knowledge of the internal implementation of the other, and is written to take benefit of that knowledge. Therefore anything that has the potential to decrease the amount of inside knowledge will tend to weaken the coupling. Therefore, information hiding and encapsulation. The Java's visibility levels: private, package, protected, public - progressively expose detail to other classes, and therefore raise the potential for stronger coupling. Interfaces are one way to decrease to reduce coupling - as you interact with a class through an abstract definition, instead of a concrete implementation.

   Related Questions in Programming Languages

©TutorsGlobe All rights reserved 2022-2023.