Description
Each module must strive for high cohesion and low coupling. This smell arises when a module exhibits high coupling and low cohesion.
Context
Derived from: “Weakened Modularity”
High cohesion is one of the most important design principles. Modules should provide operations that are closely related to each other. Functionality that is likely to change together should be in the same artifact.
Cause
Often these divergent modifications are due to poor program structure.
Consequences
The maintainability and possibility for development may be reduced. It may be more difficult to analyze and grasp all provided functionality.
Detection
We compute the modularity ratio for each module by dividing the number of intra-cluster references (cohesion) and the number of inter-cluster references (coupling). To ensure that elements without internal relations modelled are not reported a minimal internal relation count has to be reached.
Solution
Split up the behavior of the module.
Cypher query
MATCH (a)-[r]-(b) <br /> WHERE (r.Label contains 'Aggregation' or r.Label contains 'Realization' or r.Label contains 'Composition' or r.Label contains 'Assignment') <br /> and a.ArchimateLayer = b.ArchimateLayer <br /> WITH a , collect (r) as rels , a+ collect (b) as cluster <br /> MATCH (m)-[r1]->(n) <br /> WHERE not (r1.Label contains 'Aggregation' or r1.Label contains 'Realization' or <br /> r1.Label contains 'Composition' or r1.Label contains 'Assignment') and <br /> (m in cluster and not n in cluster) <br /> WITH a , cluster, collect (r1) as internal <br /> MATCH (m)-[r2]->(n) <br /> WHERE not (r2.Label contains 'Aggregation' or r2.Label contains 'Realization' or <br /> r2.Label contains 'Composition' or r2.Label contains 'Assignment') and <br /> (not m in cluster and n in cluster) <br /> WITH a , cluster, internal , collect (r2) as external <br /> WHERE size (internal)< size(external) and size(internal) < $internalRels <br /> MATCH p=(a)--(b) <br /> RETURN pAliases
The Knot, Artificial Coupling
Tags
microservices, soa, business, application, technology, cohesion, The Couplers, The Change Preventers, between elements, automatic detection
Query parameters
[
{
"name": "internalRels",
"type": "number",
"default": 3,
"description": "Number of intenral relationships."
}
]Related smells
- Multifaceted Abstraction (relates)
- Dense Structure (relates)
- Hub-like Modularization (relates)