Architecting persistence (and other internal systems). Interfaces, composition, pure inheritance or centralization?
- by Vandell
Suppose that you need to implement persistence, I think that you're generally limited to four options (correct me if I'm wrong, please)
Each persistant class:
Should implement an interface (IPersistent)
Contains a 'persist-me' object that is a specialized object (or class) that's made only to be used the class that contains it.
Inherit from Persistent (a base class)
Or you can create a gigantic class (or package) called Database and make your persistence logic there.
What are the advantages and problems that can come from each of one? In a small (5kloc) and algorithmically (or organisationally) simple app what is probably the best option?