0
6.3kviews
Define cohesion and coupling in system design? High cohesion and low coupling is recommended for good system design. Justify.
1 Answer
1
173views

Cohesion:

  • The cohesion of a component is a measure of the closeness of the relationship between its components.
  • Logical cohesion: It is the next higher level of cohesion, where several logically related functions or data elements are placed in same component.
  • Temporal cohesion: Sometime a component is used to initialize a system or a set variables. Such a component performs several functions in sequence, but the functions are related by the timing involved, so its cohesion is temporal.
  • Procedurally cohesion: When function are grouped together in a component just to ensure this order the component is procedurally cohesive.
  • Communication ally cohesion: Communication ally cohesion often destroys the modularity and functional independence of the design.
  • Sequential cohesion: If the output from one part of a component is input to the next part the component has sequential cohesion.

Coupling

  • Coupling is measure of the independence of components.
  • Coupling is related to cohesion.
  • It is an indication the strength of inter connections between the components in a design.
  • Highly coupled: These types of systems have interconnections, with program units dependent on each other.

enter image description here

  • Loosely coupled: Loosely coupled systems are made up of components which are independent or almost independent. In this less dependences are available.

enter image description here

  • The range of coupling measures

enter image description here

  • Content coupling: When one component actually modifies another. Then the modified component is completely dependent on the modifying one.

enter image description here

Common coupling: We can reduce the amount of coupling somewhat by organizing our design so that data are accessible from a common data store.

enter image description here

  • Control coupling: When one component passes parameters to control the activity of another component. We say that there is control coupling between the two.
  • Stamp coupling: When data structure is used to pass information from one component to another.
  • Data coupling: If only data are passed, the components are connected by data coupling.

Justification High cohesion and low coupling is recommended for good system design

Low coupling is in the context of two or many modules. If a change in one module results in many changes in other module then they are said to be highly coupled. This is where interface based programming helps. Any change within the module will not impact the other module as the interface (the mean of interaction ) between them has not changed.

High cohesion- Put the similar things together. So a class should have method or behaviors to do related job. Just to give an exaggerated bad example: An implementation of List interface should not have operation related to String. String class should have methods, fields which is relevant for String and similarly, the implementation of List should have corresponding things.

That is why High cohesion and low coupling is recommended for good system design.

Please log in to add an answer.