The literary meanings of word "cohesion" are consistency and organization of different units. In computer science and software engineering, cohesion refers to the level of strength and unity with which different components of a software program are inter-related with each other. It has remained a norm in software engineering that software programs are developed through different inter-related functions (or modules), and each of these modules have separate tasks associated with them. Cohesion of any software determines the strength of its source code, and can be further comprehended through exploring its associative principles, types, and calculating methods.
The concept of cohesion is introduced to capture the 'quality', 'conciseness' and 'effectiveness' features of a program into software engineering domain. This concept makes it easy to determine how closely-linked each module of software program is, which indicates how rapidly it can perform different tasks assigned to it. Increased cohesion of a software program is obtained through very identical operations performed by its different modules, and is inversely proportional to the decreased number of modules. This means that a software program designed to perform multiple tasks through multiple modules has a higher probability of having lower cohesion, which negatively affects its overall performance and effectiveness on computing machines.
Associative principles of software cohesion refer to the relationship types between a software module and corresponding actions (operations). These principles collectively constitute the cohesion of any software program, and vary according to its different operational requirements. There are seven associative principles formalized for seven types of software cohesion, which includes coincidental, logical, temporal, procedural, communicational, sequential, and functional cohesions. Each of these cohesion types has a unique associative principle associated with it, which define its action properties for any software module.
There are certain pre-defined properties associated with cohesion in software engineering. For instance, if any software is constituted of three different modules and all of them are similar to each other in terms of actions, the overall cohesion of the software program increases. Similarly, the cohesion decreases if these modules have entirely different and unique actions associated with them. Furthermore, cohesion of software programs is also dependent upon the types of data it processes, and is inversely proportional to the increased number of data types.
Cohesion of a software program can be analysis through both quantitative and qualitative methods. In qualitative measurement process, the textual code of the software program is analyzed by taking its different samples and evaluating them according to the coding standards of the respective programming language. In contrast to it, quantitative evaluation of cohesion identifies the number of modules constituted within a software program and evaluates their actions according to pre-defined scales.