Coupling & Cohesion
Coupling and cohesion are fundamental principles of software architecture that affect the interaction between modules.
Classification
- ComplexityMedium
- Impact areaTechnical
- Decision typeArchitectural
- Organizational maturityIntermediate
Technical context
Principles & goals
Use cases & scenarios
Compromises
- Dynamic in the architecture
- Faulty interactions between modules
- High dependencies
- Regular review of the architecture
- Involve the entire team
- Design simple interfaces
I/O & resources
- Requirements for the software
- Architecture diagrams
- Resource allocation
- Functional software
- Improved architecture
- High cohesion values
Description
Coupling describes how strongly modules are interconnected, while cohesion refers to the internal consistency of a module. High cohesion and low coupling are desirable properties that enhance the maintainability and flexibility of software.
✔Benefits
- Improved Maintainability
- Increased Flexibility
- Better Testing
✖Limitations
- Can be complex
- Requires careful planning
- Can lead to overhead
Trade-offs
Metrics
- Customer Satisfaction Ratings
Measurement of customer satisfaction with the software.
- Turnaround Times for Changes
Time taken to implement changes in the application.
- Error Rates
Number of errors that occurred and their impact.
Examples & implementations
E-commerce Platform
A modular e-commerce platform that provides various services through microservices.
Finance Application
A finance application that offers an improved user experience through high cohesion and low coupling.
Content Management System
A module-based system for managing digital content.
Implementation steps
Create architecture diagrams
Document the modules
Train the team
⚠️ Technical debt & bottlenecks
Technical debt
- Outdated dependencies
- Technical debts in modularization
- Insufficient test coverage
Known bottlenecks
Misuse examples
- Neglecting module boundaries
- Excessive use of global variables
- Poor documentation of modules
Typical traps
- Creating too many dependencies
- Implementing untested modules
- Implementing change requests without analysis
Required skills
Architectural drivers
Constraints
- • Budget constraints
- • Time constraints
- • Technological constraints