I have a class 'A' which is almost perfect for my needs. Class 'B' uses class 'A'
I've now designed Class 'C' and Class 'D' and noticed that there is a good chunk of code in class 'B', 'C' and 'D' for using Class 'A' is duplicated. I've separated out this code in specific, standalone functions in each of the classes.
Now I'm wondering where this code should go. At the moment, the functions are duplicated in the three calling classes (B, C and D).
Placing the functions into class 'A' would break the single responsibility principle. Inheritance to add functionality would likely break both SRP and LSP.
The one that seems that it may work is composition.
However, Is designing a complete class just for a few functions over kill?
Would it be valid for classes 'B', 'C' and 'D' to access both the new class 'E' (which would depend on A) and the old class 'A' (which would have to be the same instance as the instance in the new class 'E'), or should the new class 'E' provide sufficient functionality so that Classes B, C and D don't need to access Class A directly? It would seem that its then an incomplete interface of the original object with additional functionality (ie, incompatible)
Or should I do it a completely different way?
(and why does software design require so much thinking?)