As long as object-oriented programming is adopted, class layers are inevitable (including interfaces). Although there is a principle in object-oriented programming that multi-purpose interfaces use less inheritance, this does not mean that inheritance is not used, after all, inheritance can be implemented.CodeIt has its advantages. For your own class levels, of course, the less the better, but no matter how many is at least two layers, then 2-3 layers should be normal, 4-5 layers are a bit more, 6 layers and above, there will be more general application systems.
In my general application system, the class level is: the first layer, the top layer, which is generally non-fan type. It is used for the basic specifications and constraints of this class. The 2nd layer consists of two branches: Standard Functions and user-defined functions. The standard feature adopts the model.ProgramWhen the leaf class is used, the semantics is clearer without reverse conversion. The user-defined base class only provides the standard necessary constraints for users to handle non-standard situations. The third layer is the leaf type. The benefit of this hierarchy is that it can be inherited, and standard function classes can often use code generators to automatically generate code.
In general, the main focus is on solving 80% of the problems. The remaining 20% of the special problems can be solved by allowing users to define their own classes, in this way, the 80% part will not be too complicated due to some special problems of 20% or even less.