samedi 7 janvier 2023

When to use Parent Classes vs Interfaces for this scenario

I have the following context:

Model Diagram

The classes in grey are the "concrete" classes I actually need.

What combination of interfaces and classes should I use to build the Category, Exercise, Schedule, Plan, Note, and PracticeRecord classes?

Should the Name and Description properties be added as an interface rather than a having a parent class? Should the SHARES_ID property be added as an interface rather than a having a parent class?

What I am trying to get out of this is the ability to implement generic CRUD repositories that can handle any of the Category, Exercise, Schedule, Plan, Note, and PracticeRecord classes. In addition to that, I would like to be able to implement generic queries to get (say) the name of any of the Category, Exercise, Schedule, Plan, and Note classes (any class that has a name).

Aucun commentaire:

Enregistrer un commentaire