SOLID are a set of 5 principles intended to help the developers produce maintenable, readable and flexible
code:
single-responsibility principle
open–closed principle
Liskov substitution principle
interface segregation principle:
dependency inversion principle
Single-Responsibility Principle
The main description of the SRP is often the following: "There should never be more than one reason for a class to
change."
Depending on the person describing the principle the interpretation can be different.
It is often interpreted as "every class should have only one responsibility." which is a really broad definition
that can be difficult to apply in a real environment.
I personally prefer the definition given by "Clean Architecture" of Robert Martin. He say that a module should only
depend on a given group of person (in a typical company, a group of person may be given by occupations, like
marketing, accounting, finance, ...).
For instance, a module should have to change only if accounting change the way they are calculating some value of
interest, but should never change if marketing change any of their process.
This principle is about people.
Code example
In the previous implementation, the module mix the way the values of the report are computed, which is a
responsability that can be attributed for example to finance or accounting and the way the report is presented, which
can be for example the responsability of marketing to show the good results of their marketing campaing to the CEO.
A good implementation would be to separate the two "responsability" in different module.