OOP Design Advice
I'm trying to program a simple daemon that (will eventually) compile in Windows and UNIX. Users will be able to login and have accounts set up, almost like a MUD, but it's not going to be a MUD.
I would like to really try my hand at programming something that's worthwhile of my time and effort, and so I would like to do it <i>right</i> (that's objective obviously)
I thought of having a few objects, namely one for the server listening, the configuration file (loading, saving), database routines (connecting, fetching, modifying information) as well as an object for the users, menus, etc etc.
I need some advice as to a good way of designing this system so that I can use an SQL database as a back end to store information. The trouble is, I know how much a database can bring a computer to its knees. Therefore, I would like to minimize the number of connections and queries to the database.
How do I go about designing each of my objects when a few of them depend on file I/O (be it database or flat-file) to load and save information persistently?
Should I have a database object (with each DB object <hopefully> only have one connection to the database) and have my user/menu objects inherit from it, or should I pass the DB object into each user and menu object ?
Hopefully it wasn't too confusing, but perhaps someone can point me in the right direction or give some sound advice in this matter.
Thanks.
__________________
"You looked at me as if I was eating runny eggs in slow motion." - Gord Downie of The Tragically Hip
|