Cohesion and Single Responsibility Principle

Connect with

Cohesion and Single Responsibility PrincipleLearn different aspects of Cohesion and Single Responsibility Principle in software design principle.

1. Overview of Cohesion and Single Responsibility Principle

According to the English dictionary, Cohesion means “sticking together” but as per design principle what it means? You may be asked this question for your level of interview, interviewer coined these terms to check the basic of the design principle.
And what does it mean the Single Responsibility principles? Learn step by step and read this till the end to understand much cohesion and single responsibility principle.

2. SRP ( Single Responsibility Principle)

“A class should have only one reason to change”

What does it mean in software engineering? When we talk about the design principle we always talk about the best practices. When we design a component we always keep a few things in mind like Single Responsibility, here Responsibility means a task to adhere to in class. More responsibility to a class means more reason to change.

3. what is Cohesion

High Cohesion is a desirable state

In software engineering, while designing a component, the Cohesion term used to measure how closely a class or a module supports a single purpose or responsibility. Classes that adhere to the principle tends to have high cohesion. If a class or module having high cohesion it means it’s a good practice or you can say it’s a desirable state. Classes having multiple responsibilities means multiple reasons to change that class, it means low cohesion which is an undesirable state in software engineering practices.

4. Key Points of Cohesion and Single Responsibility

  • Cohesion is more general concept than Single Responsibility Principle, but the two are closely related.
  • Classes that adhere to the principle tends to have High Cohesion.
  • Single Responsibility Principle and High Cohesion goes hands-in-hands.

5. Reference

Visit Wiki: Single Responsibility for more details.

I hope you enjoyed this post about Cohesion and Single Responsibility principle, you can visit Software Architecture tutorial for more details.
Suggestions are welcome, please write your comment to improve this post of Cohesion vs SRP ( Single Responsibility Principle).

Connect with

3 thoughts on “Cohesion and Single Responsibility Principle”

  1. Pingback: notName

  2. Pingback: kumud

  3. Pingback: 2019

Leave a Comment

Your email address will not be published. Required fields are marked *