Contents
The Practical Guide To Structured Systems Design
Meilir Page-Jones
Yourdon Press 1980
ISBN: 0-917072-17-0
Section III – The Qualities of a Good Design
One of the fundamental principles of Structured Design is that a large system should be partitioned into manageable modules. However, it is vital that this partitioning should be carried out in such a way that the modules are as independent as possible — this is the criterion of coupling, covered in Chapter 6 — and that each module carries out a single, problem-related function — the criterion of cohesion, discussed in Chapter 7.
Coupling
The first way of measuring design quality we’ll explore is coupling, the degree of interdependence between two modules. Our objective is to minimize coupling; that is, to make modules as independent as possible. Low coupling between modules indicates a well-partitioned system and can be attained in one of three ways:
- by eliminating unnecessary relationships
- by reducing the number of necessary relationships
- by easing the “tightness” of necessary relationships
Cohesion
Another way to determine partitioning is to look at how the activities within a single module are related to one another: This is the criterion of cohesion. Since coupling and cohesion both are ways of measuring partitioning, you’d expect them to be interdependent. Indeed, they are, in that the cohesion of a module often determines how tightly it will be coupled to other modules in a system.
The Practical Guide To Structured Systems Design – 2nd edition
Second edition: Prentice-Hall 1988
ISBN 0-13-690777-6
NL vertaling:
Samenhang (cohesion). De mate waarin de componenten van een module (de afzonderlijke computerinstructies waaruit de module is opgebouwd) nodig en voldoende zijn om één goed-gedefinieerde functie uit te voeren.
Koppeling (coupling). Dit is de mate waarin modulen met elkaar verbonden of aan elkaar gerelateerd zijn. Hoe sterker de koppeling tussen de modulen in een systeem, des te lastiger is het om deze te implementeren en het systeem te onderhouden.
stackoverflow
https://stackoverflow.com/questions/14000762/what-does-low-in-coupling-and-high-in-cohesion-mean
Cohesion refers to the degree to which the elements of a module/class belong together, it is suggested that the related code should be close to each other, so we should strive for high cohesion and bind all related code together as close as possible. It has to do with the elements within the module/class.
Coupling refers to the degree to which the different modules/classes depend on each other, it is suggested that all modules should be independent as far as possible, that’s why low coupling. It has to do with the elements among different modules/classes.
enterprisecraftsmanship
https://enterprisecraftsmanship.com/posts/cohesion-coupling-difference/
Cohesion represents the degree to which a part of a code base forms a logically single, atomic unit.
It can also be put as the number of connections inside some code unit. If the number is low, then the boundaries for the unit are probably chosen badly, the code inside the unit is not logically related.
Coupling, on the other hand, represents the degree to which a single unit is independent from others. In other words, it is the number of connections between two or more units. The fewer the number, the lower the coupling.
The notion of cohesion is akin to the Single Responsibility Principle. SRP states that a class should have a single responsibility (a single reason to change), which is similar to what highly cohesive code does.
The difference here is that while high cohesion does imply code have similar responsibilities, it doesn’t necessarily mean the code should have only one. I would say SRP is more restrictive in that sense.
High cohesion, loose coupling
https://asleekgeek.com/high-cohesion-loose-coupling-1731b1f74bf6
There are several types of cohesion