Object Oriented Software Engineering   View all facts   Glossary   Help
subject > criterion > quality > software quality > coupling
Next measurementcoverage    Upmeasurement, software quality    Previous measurementcohesion   

coupling comparison table
Subject avoid by be avoided minimize be cause is a subtopic of have example occur in occur avoid have disadvantage has definition share reduce by name after use by
common couplingcreating a module that has specially-designated public methods, which can be called to obtain or modify the system-wide default values  hard to assess 9.2 - Principles Leading to Good Design     A form of coupling in which components share data using a global variable and thus become dependent on each othermany of the disadvantages of content coupling   
content coupling   hard to assess 9.2 - Principles Leading to Good Design   since any modification of data should be easy to find and easy to understand An undesirable form of coupling in which a component surreptitiously modifies internal data of another component    
control coupling   hard to assess 9.2 - Principles Leading to Good Design
public routineX(String command)
{
//routineX will have to change whenever any of its callers adds a new command
if (command.equals("drawCircle")
{
drawCircle();
}
else
{
drawRectangle();
}
}
 when one procedure calls another using a 'flag' or 'command' that explicitly controls what the second procedure does  A form of coupling in which one component affects the sequence of execution in another 
  • having the callers of the routine directly call the methods called in the second routine
  • the use of polymorphic operations
  • using a look-up table that maps a command to a method that should be called when that command is issued
common blocks in the Fortran language which are used to hold global variables 
data coupling   always present to some extent 9.2 - Principles Leading to Good Design    components become coupled because they are dependent on each other's interpretation of the meaning of the arguments; if that meaning changes in one component, then the other component may have to change to accommodate the new meaningA form of coupling in which one component passes simple data to another as an argument 
  • not passing unnecessary arguments
  • passing few arguments, each containing more abstract information
      
    external coupling   hard to assess 9.2 - Principles Leading to Good Design     A form of coupling in which a software component has a dependency to software written by a third party, or to a particular type of hardware 
    • reducing the number of places in the code where such dependencies exist
    • using the facade pattern
      
    import coupling   a weaker form of inclusion couplinga system to suddenly fail if a new item is added to an imported file, and this new item has the same name as something you have already defined in your subsystem9.2 - Principles Leading to Good Design    if the imported component changes something on which the importer relies, or adds something that raises a conflict with something in the importer, then the importer must changeA form of coupling in which one component declares that it imports (makes use of the definitions in) another not importing packages or classes which you do not need Java
    inclusion coupling   a stronger form of import coupling 9.2 - Principles Leading to Good Design    if the included component changes something on which the includer relies, or adds something that raises a conflict with something in the includer, then the includer must changeA form of coupling in which one component includes the source code of another component. All the includers of a component are coupled to each other and to the included file not including components which you do not need C and C++
    low coupling   hard to assess 3.2 - Incorporating Reusability and Reuse Into Software Engineering     A kind of coupling in which the interconnections among parts of a system are reduced, making makes the resulting application easier to understand, modify and test    
    routine call coupling   always present in an object oriented system 9.2 - Principles Leading to Good Design     A form of coupling in which one routine calls another reducing the total number of routines that a particular class or package calls: If you use a sequence of two or more methods to compute something, and this sequence is used in more than one place, then you can reduce routine call coupling by writing a single routine that encapsulates the sequence  
    stamp coupling   hard to assess 9.2 - Principles Leading to Good Design    if the shared class changes, then all the classes that access its variables will likely have to changeA form of coupling in which two components modify or access data in the same object requiring that all variables of the shared class only be accessible via methods  
    tight coupling   hard to assessa system to be hard to understand and change because
    • changes in one place will require changes somewhere else. Requiring changes to be made in more than one place is problematic since it is time-consuming to find the different places that need changing, and it is likely that errors will be made
    • A network of interdependencies makes it hard to see at a glance how some component works
    9.2 - Principles Leading to Good Design          
    type use coupling   similar to common coupling, but instead of data being shared, only data types are shared 9.2 - Principles Leading to Good Design typed languages such as Javawhen a class declares a variable as having another class as its type if the type definition changes, then the users of the type may well have to change.A form of coupling in which several components make use of the same globally-defined data type 
    • ensuring that a class is only type-coupled to classes in a relatively small number of packages
    • declaring the type of a variable to be the most general possible class or interface that contains the required operations
      

    Next measurementcoverage    Upmeasurement, software quality    Previous measurementcohesion