Home Knowledge Base Coupling and Cohesion

Coupling and Cohesion are the two fundamental architectural properties that determine whether a software system is modular, maintainable, and independently deployable — cohesion measuring how closely related and focused the responsibilities within a single module are, coupling measuring how strongly interconnected different modules are to each other — with the universally accepted design goal being High Cohesion + Low Coupling, which produces systems where modules can be modified, tested, replaced, and scaled independently.

What Are Coupling and Cohesion?

These two properties are the core tension of software architecture:

Cohesion — Internal Relatedness

Cohesion measures whether a module's internals belong together. A highly cohesive module has a single, well-defined responsibility where all its methods and fields work together toward one purpose.

Cohesion LevelDescriptionExample
Functional (Best)All elements contribute to one taskEmailSender — only sends emails
SequentialOutput of one part is input to nextData pipeline stage
CommunicationalParts operate on same dataReport generator
ProceduralParts execute in sequenceTransaction processor
TemporalParts run at the same timeSystem startup module
LogicalParts do related but separate thingsStringUtils (mixed string operations)
Coincidental (Worst)Parts have no relationshipUtils, Helper, Manager classes

Coupling — External Interconnection

Coupling measures how much one module knows about and depends on another:

Coupling LevelDescriptionExample
Message (Best)Calls methods on a published interfacepaymentService.charge(amount)
DataPasses simple data through parametersformatName(firstName, lastName)
StampPasses complex data structuresprocessOrder(orderDTO)
ControlPasses a flag that controls behaviorprocess(mode="async")
ExternalDepends on external interfaceDepends on specific API format
CommonShares global mutable stateShared global configuration object
Content (Worst)Directly modifies internal stateOne class modifying another's fields

Why Coupling and Cohesion Matter

Measuring Coupling and Cohesion

Coupling Metrics:

Cohesion Metrics:

Practical Design Principles Derived from Coupling/Cohesion

Tools

Coupling and Cohesion are the yin and yang of software architecture — the complementary forces where maximizing internal focus (cohesion) while minimizing external entanglement (coupling) produces systems that are independently testable, independently deployable, and independently comprehensible, enabling engineering organizations to scale team size and development velocity without the coordination overhead that kills large software projects.

coupling and cohesioncode ai

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.