Cohesion and Coupling

Coupling

  • low coupling is good
  • data coupling (two modules are data-coupled if all arguments are homogeneous data items. That is, every argument is either a simple argument or a data structure in which all elements are used by the calling module)
  • stamp coupling (two modules are stamp-coupled if a data structure is passed as an argument, but the called module operates on only some of the individual components of that data structure)
  • control coupling (two modules are control-coupled if one passes an element of control to the other module; that is, one module explicitly controls the logic of the other module)
  • common coupling (two modules are common-coupled if they both have access to the same global data)
  • content coupling (two modules are content-coupled if one directly references the contents of the other)
  • high coupling is bad
  • When there are several answers, pick the worst one - the one with highest coupling
  • However, high coupling can be good, if these are strongly related modules