Sobes.tech
Middle

What is connectivity?

sobes.tech AI

Answer from AI

Coupling is a measure of dependency between modules or components of a program.

  • High coupling: Changes in one module require changes in another. It complicates maintenance, testing, and reuse.
  • Low coupling: Modules are relatively independent. Changes in one module minimally affect others. It promotes flexibility, modularity, and easier testing.

Examples of types of coupling (from best to worst):

  • Data coupling: Modules exchange data through function parameters. Ideal.
  • Stamp coupling: A module passes a data structure to another module, but the receiver only uses part of this structure. Less flexible.
  • Control coupling: A module passes a flag or command that determines the behavior of another module. It complicates understanding the flow.
  • Common coupling: Modules use the same global variable or shared memory area. Very dangerous, hard to track changes.
  • Content coupling: One module directly accesses the internals of another module (e.g., local variables). The worst type, completely breaks encapsulation.

The goal is to strive for low coupling to create more maintainable and flexible code.

What is connectivity? — PHP - sobes.tech