Coupling in Software Engineering




  • The degree of interdependence between two modules”
  • We aim to minimise coupling - to make modules as independent as possible
  • Low coupling can be achieve by:
  • eliminating unnecessary relationships
  • reducing the number of necessary relationships
  • easeing the ‘tightness’ of necessary relationships

Types of Coupling

  • Data coupling       (Most Required)    
  • Stamp coupling
  • Control coupling
  • Hybrid coupling
  • Common coupling
  • Content coupling  (Least Required)

Data Coupling 

  • Modules communicate by parameters
  • Each parameter is an elementary piece of data
  • Each parameter is necessary to the communication
  • Nothing extra is needed

Data coupling problems

  • Too many parameters - makes the interface difficult to understand and possible error to occur
  • Tramp data - data ‘traveling’ across modules before being used

Stamp coupling

  • A composite data is passed between modules
  • Internal structure contains data not used
  • Bundling - grouping of unrelated data into an artificial structure

Control coupling

  • A module controls the logic of another module through the parameter
  • Controlling module needs to know how the other module works - not flexible!

Hybrid coupling

  • A subset of data used as control
  • Example: account numbers 00001 to 99999
  • If 90000 - 90999, send mail to area code of last 3 digit (000 - 999)

Common coupling

  • Use of global data as communication between modules
  • Dangers of
  • ripple effect
  • inflexibility
  • difficult to understand the use of data

Content coupling

  • A module refers to the inside of another module
  • Branch into another module
  • Refers to data within another module
  • Changes the internal workings of another module
  • Mostly by low-level languages