5 posts about Cohesion by 4 contributors.
Know Cohesion? Share what you know with developers who are learning it.
In this article, you will learn about the Single Responsibility Principle. The Single Responsibility Principle (SRP) in SOLID, emphasized by Robert C. Martin, asserts that a class or function should have only one reason to change, promoting simplicity and maintainability.
This article explains the basic rules which are combined and called the SOLID Principles. SOLID principles are a set of design principles in object-oriented programming (OOP) that help developers create more maintainable, flexible, and robust software. These principles were introduced by Robert C. Martin and are represented by the acronym SOLID, where each letter stands for a different principle.
One of the aspects of code quality we can look at is cohesion. If code is highly cohesive it is also much more testable, reusable, readable and maintainable (all the good things in life). Likewise, if code has a low level of cohesion it is often very hard to understand at a glance and difficult to test and maintain. In this article we'll take a look at a concrete example of code that does not follow the Single Responsibility Principle and as a result has low cohesion and walk through the refactoring it takes to modify the code to be more highly cohesive.
Here we will discuss the second letter in the word SOLID i.e., O. O stands for OCP (Open Closed Principle).
This article will cover the acronyms for SOLID and a brief introduction to Cohesion and Coupling is provided to understand the SOLID principles.
DevSocialUpcoming · 3rd editionAI Agents ConferenceNov 23–27, 2026Live onlineMembers only16days leftRegisterPublish an article in this category and earn +1,000 SHARP when it is approved.
Write an article