vendredi 8 mars 2019

What design pattern for saving and loading multiple classes?

I have various classes in my project such as Customer, Real Estate, House and Flat... For each of them, I have to save and load objects. I think I should not create save() and load() functions inside of every classe because it will not respect the Single Responsibility Principle.

Therefore, I suppose I should create for each of my classes, an Export classe like ExportCustomer, ExportRealEstate and create inside of theses "Export classes" save() and load() functions.

Is this the correct way to do saving and loading or should I use something else ?

Thank you for your help !

1 commentaire: