Where to code the database management of some entities in oop environtment
Say i have some entity classes like:
avatar category set
well all of them have name and description so i inherit it from abstract class.
what i really want is, these classes need to be retreiv开发者_Python百科ed from a database.
Where to code the querys?
a) In external class, like "dbmanager" where you do something like dbmanager->sync(object_to_be_updated), then this class detects the class instance of object_to_be_updated, switch and does datbase stuff returning the updated object.
OR
b) Having just a method on each avatar, category, set doing the properly stuff.
精彩评论