Coupling

Coupling
Coupling is how much each program module relies on the other modules in the program. Low coupling often results in high cohesion and vice-versa. Low coupling is the goal when developing, it produces a well-structured system and a good design. A program with low coupling is easily expandable and very flexible.

In Object-Oriented programming coupling is unavoidable. So the goal is to reduce unnecessary dependencies between objects.

=Java Example= code format="java" class Dog{ //high coupling //However uses this class must know to follow your convention //that doAction(1) means bark and doAction(2) means jump. void doAction(int number){ if(number == 1){ //bark code }else if(number == 2){ //jump code }   }    //low coupling //No confusion here and each function does one thing following //the rules for high cohesion. void doActionBark{ //bark code }   void doActionJump{ //jump code } } code