Cohesion and Coupling Concept in Programming:
In computer programming, Coupling, also known as dependency, is the extent of which every single module in a program is dependent on all of the other modules. Cohesion, on the other hand, is a measure of how strongly-related the operability communicated by the source code of a software module is. The program quality metrics of coupling and cohesion were the creation of Larry Constantine, who was one of the original developers of Structured Design. The two metrics of Coupling and Cohesion commonly transpire simultaneously. Together these concepts point out the characteristics a program module should have.
Coupling identifies the interconnections between the varieties of modules. For example, low coupling is indicative of a well-structured computer system and an effective design. Combining low coupling with high cohesion reinforces the overall goals of high readability and sustainability. Coupling can be "low" (also "loose" and "weak") or "high" (also "tight" and "strong"). Some coupling types are as follows:
Ø Content coupling (high)
Ø Common coupling
Ø External coupling
Ø Control coupling
Ø Stamp coupling (Data-structured coupling)
Ø Data coupling
Ø Message coupling (low)
Ø No coupling
In contrast, Cohesion illustrates how associated operations within a module are. For example, low cohesion infers that the module carries out tasks that are not really connected to one another, which means problems can arise as the module evolves. Cohesion is a qualitative metric that means that the source code syntax to be evaluated is examined using specific guidelines to establish a cohesion classification. Some Cohesion types are as follows:
Ø Coincidental cohesion (worst)
Ø Logical cohesion
Ø Temporal cohesion
Ø Procedural cohesion
Ø Communicational cohesion
Ø Sequential cohesion
Ø Functional cohesion (best)
Cohesion and Coupling Concept outside Programming:
The Cohesion and Coupling concepts are concepts that are not just confined to the world of computer programming, in fact, these concepts can be applied in a number of areas outside of computer programming. Now, even though there are a variety of areas that the Cohesion and Coupling concepts can be applied outside of programming, we are going to focus on just one because of its strong resemblances to software applications.
The non-programming environment example we will utilize to better explain the Cohesion and Coupling concepts is the workflow process. In the workflow process, weak coupling of actions will likely lead to a reduction in the information that must be exchanged between actions in the workflow process. In addition, a decrease in the probability of execution errors is to be expected. In contrast, people would comprehend and execute tasks that are vastly cohesive in a more efficient manner than they would if sizeable amounts of isolated work were being compiled together.
Since the formation of large activities would likely lead to a reduction in the level of coupling and the fabrication of smaller tasks will augment cohesion, high cohesion and loose coupling would likely produce the appropriate balance in the process to enhance both performance quality and sustainability of a workflow model.
No comments:
Post a Comment