Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions docs/anchors/cohesion-criteria.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
= Cohesion Criteria
:categories: design-principles
:roles: software-architect, software-developer, consultant, educator
:related: grasp, solid-srp, clean-architecture, vertical-slice-architecture
:proponents: Larry Constantine, Edward Yourdon
:tags: cohesion, coupling, module design, structured design, code quality
:tier: 2

[%collapsible]
====
Full Name:: Cohesion Criteria (Constantine & Yourdon)

Also known as:: Levels of Cohesion, Cohesion Scale, Module Cohesion Types

[discrete]
== *Core Concepts*:

Seven levels of cohesion, ranked from worst (1) to best (7):

Coincidental Cohesion (1):: Elements are grouped arbitrarily with no meaningful relationship. Typical sign: utility classes or grab-bag modules.

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.

Temporal Cohesion (3):: Elements are grouped because they execute at the same time. Example: startup initialization routines bundled together.

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.

Communicational Cohesion (5):: Elements operate on the same data but perform different operations. Example: a module that both validates and formats a customer record.

Sequential Cohesion (6):: The output of one element serves as input to the next, forming a pipeline. Example: parse -> validate -> transform.

Functional Cohesion (7):: Every element contributes to a single, well-defined task. The ideal. Example: `calculateShippingCost()` does exactly one thing.


Key Proponents:: Larry Constantine and Edward Yourdon ("Structured Design", 1979). Further developed by Meilir Page-Jones ("The Practical Guide to Structured Systems Design", 1988).

[discrete]
== *When to Use*:

* Evaluating module quality during code reviews or refactoring
* Deciding whether to split a class or module that feels too large
* Arguing for refactoring with concrete criteria instead of gut feeling
* Teaching software design: the scale makes abstract quality tangible
* Assessing architecture decisions around module boundaries

[discrete]
== *Related Anchors*:

* <<grasp,GRASP>> - "High Cohesion" is one of the nine GRASP patterns
* <<solid-srp,SOLID SRP>> - Single Responsibility Principle targets functional cohesion
* <<clean-architecture,Clean Architecture>> - Organizes code by cohesive business rules
* <<vertical-slice-architecture,Vertical Slice Architecture>> - Groups by feature cohesion rather than technical layer
====
53 changes: 53 additions & 0 deletions docs/anchors/cohesion-criteria.de.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
= Kohäsionskriterien
:categories: design-principles
:roles: software-architect, software-developer, consultant, educator
:related: grasp, solid-srp, clean-architecture, vertical-slice-architecture
:proponents: Larry Constantine, Edward Yourdon
:tags: cohesion, coupling, module design, structured design, code quality
:tier: 2

[%collapsible]
====
Vollständiger Name:: Kohäsionskriterien (Constantine & Yourdon)

Auch bekannt als:: Kohäsionsstufen, Kohäsionsskala, Modulkohäsionstypen

[discrete]
== *Kernkonzepte*:

Sieben Stufen der Kohäsion, geordnet von schlecht (1) bis ideal (7):

Zufällige Kohäsion (1):: Elemente sind willkürlich gruppiert, ohne sinnvollen Zusammenhang. Typisches Zeichen: Utility-Klassen oder Sammelmodule.

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.

Temporale Kohäsion (3):: Elemente sind gruppiert, weil sie zur gleichen Zeit ausgeführt werden. Beispiel: Initialisierungsroutinen beim Programmstart.

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.

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.

Sequentielle Kohäsion (6):: Die Ausgabe eines Elements dient als Eingabe des nächsten, eine Pipeline bildend. Beispiel: parsen -> validieren -> transformieren.

Funktionale Kohäsion (7):: Jedes Element trägt zu genau einer wohldefinierten Aufgabe bei. Das Ideal. Beispiel: `berechneVersandkosten()` tut genau eine Sache.


Hauptvertreter:: Larry Constantine und Edward Yourdon ("Structured Design", 1979). Weiterentwickelt von Meilir Page-Jones ("The Practical Guide to Structured Systems Design", 1988).

[discrete]
== *Wann verwenden*:

* Bewertung der Modulqualität bei Code Reviews oder Refactoring
* Entscheidung, ob eine Klasse oder ein Modul aufgeteilt werden sollte
* Argumentation für Refactoring mit konkreten Kriterien statt Bauchgefühl
* Lehre im Softwaredesign: die Skala macht abstrakte Qualität greifbar
* Bewertung von Architekturentscheidungen zu Modulgrenzen

[discrete]
== *Verwandte Anker*:

* <<grasp,GRASP>> - "High Cohesion" ist eines der neun GRASP-Patterns
* <<solid-srp,SOLID SRP>> - Single Responsibility Principle zielt auf funktionale Kohäsion
* <<clean-architecture,Clean Architecture>> - Organisiert Code nach kohäsiven Geschäftsregeln
* <<vertical-slice-architecture,Vertical Slice Architecture>> - Gruppiert nach Feature-Kohäsion statt technischer Schicht
====
6 changes: 6 additions & 0 deletions docs/changelog.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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

== 2026-04-07

*New anchors* (proposed by Gernot Starke):

* *Cohesion Criteria (Constantine & Yourdon)* — Seven levels of module cohesion from coincidental to functional

== 2026-04-01

*New anchors:*
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions skill/semantic-anchor-translator/references/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ Source: https://github.com/LLM-Coding/Semantic-Anchors
- **Proponents:** Craig Larman
- **Core:** 9 patterns for OO responsibility assignment — Information Expert, Creator, Controller, Low Coupling, High Cohesion, Polymorphism, Pure Fabrication, Indirection, Protected Variations

### Cohesion Criteria (Constantine & Yourdon)
- **Also known as:** Levels of Cohesion, Cohesion Scale, Module Cohesion Types
- **Proponents:** Larry Constantine, Edward Yourdon
- **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)

### CRC-Cards
- **Also known as:** CRC Cards, Class-Responsibility-Collaboration Cards
- **Proponents:** Ward Cunningham, Kent Beck
Expand Down
Loading