SOLID: Single Responsibility Principle
Get familiar with the Single Responsibility principle along with its examples.
Introduction
The Single Responsibility principle (SRP) is perhaps the least understood SOLID concepts. Robert C. Martin coined the term and defines it as follows: “A class should have only one reason to change.” This implies that any class or component in our code should only have one functionality. Everything in the class should be related to just one goal.
When programmers need to add features or new behavior, they frequently integrate everything within the current class. When something needs to be changed later, due to the ...