Skip to content

Commit e618176

Browse files
authored
Merge pull request #411 from raifdmueller/feat/cohesion-criteria-anchor
feat: add Cohesion Criteria (Constantine & Yourdon) anchor
2 parents 21767d6 + 8e3470f commit e618176

5 files changed

Lines changed: 122 additions & 0 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
= Cohesion Criteria
2+
:categories: design-principles
3+
:roles: software-architect, software-developer, consultant, educator
4+
:related: grasp, solid-srp, clean-architecture, vertical-slice-architecture
5+
:proponents: Larry Constantine, Edward Yourdon
6+
:tags: cohesion, coupling, module design, structured design, code quality
7+
:tier: 2
8+
9+
[%collapsible]
10+
====
11+
Full Name:: Cohesion Criteria (Constantine & Yourdon)
12+
13+
Also known as:: Levels of Cohesion, Cohesion Scale, Module Cohesion Types
14+
15+
[discrete]
16+
== *Core Concepts*:
17+
18+
Seven levels of cohesion, ranked from worst (1) to best (7):
19+
20+
Coincidental Cohesion (1):: Elements are grouped arbitrarily with no meaningful relationship. Typical sign: utility classes or grab-bag modules.
21+
22+
Logical Cohesion (2):: Elements perform similar activities selected by a control flag. Example: a function handling all I/O (read, write, print) chosen by a parameter.
23+
24+
Temporal Cohesion (3):: Elements are grouped because they execute at the same time. Example: startup initialization routines bundled together.
25+
26+
Procedural Cohesion (4):: Elements are grouped because they follow a specific execution sequence. Example: a function that validates input, then opens a file, then writes a log.
27+
28+
Communicational Cohesion (5):: Elements operate on the same data but perform different operations. Example: a module that both validates and formats a customer record.
29+
30+
Sequential Cohesion (6):: The output of one element serves as input to the next, forming a pipeline. Example: parse -> validate -> transform.
31+
32+
Functional Cohesion (7):: Every element contributes to a single, well-defined task. The ideal. Example: `calculateShippingCost()` does exactly one thing.
33+
34+
35+
Key Proponents:: Larry Constantine and Edward Yourdon ("Structured Design", 1979). Further developed by Meilir Page-Jones ("The Practical Guide to Structured Systems Design", 1988).
36+
37+
[discrete]
38+
== *When to Use*:
39+
40+
* Evaluating module quality during code reviews or refactoring
41+
* Deciding whether to split a class or module that feels too large
42+
* Arguing for refactoring with concrete criteria instead of gut feeling
43+
* Teaching software design: the scale makes abstract quality tangible
44+
* Assessing architecture decisions around module boundaries
45+
46+
[discrete]
47+
== *Related Anchors*:
48+
49+
* <<grasp,GRASP>> - "High Cohesion" is one of the nine GRASP patterns
50+
* <<solid-srp,SOLID SRP>> - Single Responsibility Principle targets functional cohesion
51+
* <<clean-architecture,Clean Architecture>> - Organizes code by cohesive business rules
52+
* <<vertical-slice-architecture,Vertical Slice Architecture>> - Groups by feature cohesion rather than technical layer
53+
====
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
= Kohäsionskriterien
2+
:categories: design-principles
3+
:roles: software-architect, software-developer, consultant, educator
4+
:related: grasp, solid-srp, clean-architecture, vertical-slice-architecture
5+
:proponents: Larry Constantine, Edward Yourdon
6+
:tags: cohesion, coupling, module design, structured design, code quality
7+
:tier: 2
8+
9+
[%collapsible]
10+
====
11+
Vollständiger Name:: Kohäsionskriterien (Constantine & Yourdon)
12+
13+
Auch bekannt als:: Kohäsionsstufen, Kohäsionsskala, Modulkohäsionstypen
14+
15+
[discrete]
16+
== *Kernkonzepte*:
17+
18+
Sieben Stufen der Kohäsion, geordnet von schlecht (1) bis ideal (7):
19+
20+
Zufällige Kohäsion (1):: Elemente sind willkürlich gruppiert, ohne sinnvollen Zusammenhang. Typisches Zeichen: Utility-Klassen oder Sammelmodule.
21+
22+
Logische Kohäsion (2):: Elemente führen ähnliche Aktivitäten aus, die über ein Steuerflag ausgewählt werden. Beispiel: eine Funktion für alle I/O-Operationen (lesen, schreiben, drucken), gesteuert durch einen Parameter.
23+
24+
Temporale Kohäsion (3):: Elemente sind gruppiert, weil sie zur gleichen Zeit ausgeführt werden. Beispiel: Initialisierungsroutinen beim Programmstart.
25+
26+
Prozedurale Kohäsion (4):: Elemente sind gruppiert, weil sie einer bestimmten Ausführungsreihenfolge folgen. Beispiel: eine Funktion, die Eingaben validiert, dann eine Datei öffnet, dann ein Log schreibt.
27+
28+
Kommunikative Kohäsion (5):: Elemente arbeiten auf denselben Daten, führen aber unterschiedliche Operationen aus. Beispiel: ein Modul, das einen Kundendatensatz sowohl validiert als auch formatiert.
29+
30+
Sequentielle Kohäsion (6):: Die Ausgabe eines Elements dient als Eingabe des nächsten, eine Pipeline bildend. Beispiel: parsen -> validieren -> transformieren.
31+
32+
Funktionale Kohäsion (7):: Jedes Element trägt zu genau einer wohldefinierten Aufgabe bei. Das Ideal. Beispiel: `berechneVersandkosten()` tut genau eine Sache.
33+
34+
35+
Hauptvertreter:: Larry Constantine und Edward Yourdon ("Structured Design", 1979). Weiterentwickelt von Meilir Page-Jones ("The Practical Guide to Structured Systems Design", 1988).
36+
37+
[discrete]
38+
== *Wann verwenden*:
39+
40+
* Bewertung der Modulqualität bei Code Reviews oder Refactoring
41+
* Entscheidung, ob eine Klasse oder ein Modul aufgeteilt werden sollte
42+
* Argumentation für Refactoring mit konkreten Kriterien statt Bauchgefühl
43+
* Lehre im Softwaredesign: die Skala macht abstrakte Qualität greifbar
44+
* Bewertung von Architekturentscheidungen zu Modulgrenzen
45+
46+
[discrete]
47+
== *Verwandte Anker*:
48+
49+
* <<grasp,GRASP>> - "High Cohesion" ist eines der neun GRASP-Patterns
50+
* <<solid-srp,SOLID SRP>> - Single Responsibility Principle zielt auf funktionale Kohäsion
51+
* <<clean-architecture,Clean Architecture>> - Organisiert Code nach kohäsiven Geschäftsregeln
52+
* <<vertical-slice-architecture,Vertical Slice Architecture>> - Gruppiert nach Feature-Kohäsion statt technischer Schicht
53+
====

docs/changelog.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
A chronological record of all semantic anchors added to the catalog. Community contributors are credited with thanks.
44

5+
== 2026-04-07
6+
7+
*New anchors* (proposed by Gernot Starke):
8+
9+
* *Cohesion Criteria (Constantine & Yourdon)* — Seven levels of module cohesion from coincidental to functional
10+
511
== 2026-04-01
612

713
*New anchors:*

plugins/semantic-anchors/skills/semantic-anchor-translator/references/catalog.md

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

skill/semantic-anchor-translator/references/catalog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ Source: https://github.com/LLM-Coding/Semantic-Anchors
181181
- **Proponents:** Craig Larman
182182
- **Core:** 9 patterns for OO responsibility assignment — Information Expert, Creator, Controller, Low Coupling, High Cohesion, Polymorphism, Pure Fabrication, Indirection, Protected Variations
183183

184+
### Cohesion Criteria (Constantine & Yourdon)
185+
- **Also known as:** Levels of Cohesion, Cohesion Scale, Module Cohesion Types
186+
- **Proponents:** Larry Constantine, Edward Yourdon
187+
- **Core:** 7 levels of module cohesion from worst to best — Coincidental (arbitrary grouping), Logical (similar activities via flag), Temporal (same time), Procedural (execution sequence), Communicational (same data), Sequential (pipeline), Functional (single task, ideal)
188+
184189
### CRC-Cards
185190
- **Also known as:** CRC Cards, Class-Responsibility-Collaboration Cards
186191
- **Proponents:** Ward Cunningham, Kent Beck

0 commit comments

Comments
 (0)