The term cohesion in software engineering refers to the manner in which different component parts of a system work together to create a cohesive whole. In other words, cohesion is a measure of how well the parts of a system fit together.

A system with high cohesion is one in which the various parts work together in a tight, well-organized manner, while a system with low cohesion is one in which the parts are loosely coupled and tend to work independently of one another.

Cohesion is an important concept in software engineering because it can have a significant impact on the overall quality of a system. A system with high cohesion is typically easier to understand and maintain than a system with low cohesion, since the former is more organized and thus easier to comprehend.

In addition, a system with high cohesion is often more resistant to change than a system with low cohesion, since the former is less likely to be adversely affected by changes to its individual parts.

There are a number of different factors that can contribute to the cohesion of a system. In general, systems with a small number of components and a high degree of coupling between those components tend to be more cohesive than systems with a large number of components and a low degree of coupling.

Additionally, systems in which the components are highly related to one another tend to be more cohesive than systems in which the components are only loosely related.

The cohesion of a system can be measured using a variety of different metrics. One common metric is the “coupling between object classes” (CBO) metric, which measures the number of other classes to which a given class is coupled.

A high CBO score indicates a low degree of cohesion, while a low CBO score indicates a high degree of cohesion. Other cohesion metrics include the “lack of cohesion in methods” (LCOM) metric and the “depth of inheritance” (DIT) metric.

Cohesion is an important consideration in the design of software systems. Systems with high cohesion tend to be more reliable and easier to maintain than those with low cohesion. When designing a system, therefore, it is important to strive for a high degree of cohesion.

There are a number of different techniques that can be used to achieve this goal, such as designing components that are highly related to one another and minimizing the number of components in the system.

Leave a comment

Your email address will not be published. Required fields are marked *