Let’s say you have abstract class A doing some stuff. Then you have abstract class B doing other stuff.
And lastly a few normal classes, let’s say C … Z.
Both A and B provide functionality that are used by class C .. Z classes. In my case mainly an observer pattern which is static, and some __get magic + lazy-loading for a certain type of properties – this is not static. I’m thinking to merge this into one class, but then I’m sure it violates SRP 🙂
So I am extending A, B in C, D etc… Essentially all C .. Z classes inherit the functionality of the A & B classes. So besides what they are supposed to do, they also do the observer stuff and so on
Does this violate the single-responsability principle?
I don’t know if this applies to your specific case, but I find that most of the time, an abstract class and its implementation can be split into two normal classes.
For example:
Can be changed into:
This has several advantages:
It seems like you are using inheritance to couple multiple classes, but that is not what inheritance is meant for.