I have classes with many properties, which consists, in some cases, other complex classes. Not allways I’m going to use this complete schemas, but sometimes I’m doing so. What’s the best practice to create an object, deal with it and then retrieve information on demand?
I’m giving an very simple example to clarify:
Supose a class student which is related to a class professor. This class is related to other classes like classes, schedules, etc. Not allways I will need to use all this information.
Ough I to mantain the professor’s ID in object student and then load the information when I need? Should I create a property just for storing the professorID, or I create a new professor object without loading all other data into it, just storing the ID? Or neither? What’s the best practice?
Thanks.
It sounds like you are describing lazy loading.