Architecting persistence (and other internal systems). Interfaces, composition, pure inheritance or centralization?

Posted by Vandell on Programmers See other posts from Programmers or by Vandell
Published on 2012-12-16T23:04:18Z Indexed on 2012/12/16 23:19 UTC
Read the original article Hit count: 185

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:

  1. Should implement an interface (IPersistent)
  2. Contains a 'persist-me' object that is a specialized object (or class) that's made only to be used the class that contains it.
  3. 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?

© Programmers or respective owner

Related posts about architecture

Related posts about database