concept
Cohesion
Cohesion is a software design principle that measures how closely related and focused the responsibilities of a module, class, or function are. High cohesion means elements within a unit are strongly related and work together to perform a single, well-defined task, improving code maintainability and readability. It is often discussed alongside coupling, another key design concept.
Also known as: High Cohesion, Module Cohesion, Functional Cohesion, Cohesive Design, Cohesion Principle
🧊Why learn Cohesion?
Developers should learn and apply cohesion to create modular, understandable, and maintainable code, especially in large-scale or long-term projects. It is crucial in object-oriented programming, microservices architecture, and refactoring efforts to reduce complexity and prevent bugs by ensuring each component has a clear, singular purpose.