View Single Post
Old 08-08-2004, 08:07 PM   #1 (permalink)
trache
Insane
 
trache's Avatar
 
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
trache is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62