This is a design question/discussion.
I created a solution which contains about 50 classes.
I refactored the classes and removed duplicated codes by introducing new abstract classes which contain shared information between classes so that those classes inherit from them.
E.g.
Abstract ColumnBuilder
ColumnBuilderForDepartmentReport : ColumnBuilder
ColumnBuilderForStoreReport : ColumnBuilder
No now my design contains lots of classes and duplicated codes have been removed which is a positive thing.
Is this a good design?
I've heard we should be preferring Composition over Inheritance.
How would it apply to these kind of scenarios where you want to use inheritance to remove duplicated code? Should I refactor the code to use Composition? How?
Thanks