Guest_imported
New member
- Jan 1, 1970
- 0
Hi,
I have a query regarding a business object I am designing. Its the simple scenario whereby I have a database holding products - a simple table - nothing special here.
I want to create a component used by client apps to add or modify to this table. The question is, what is the best design to encapsulate these objects - ie, should one class be the database handling stuff, and another be the product info. Or should i also include a collection class to handle them all.
If having 2 or maybe 3 classes, would you make only one of them creatable, the others being handled by it.
Further, the database is Oracle and requires username/password. The question with this is; if i handle the database connection through one class, then i cannot have the classes initialisation event establish the connection, because i need to pass it this username/password, therefore do I have to have it so that i have another method, say an "initDBconnection" method which the client application must call before doing anything...
I hope that all makes sense, it is more a design question, so ideas as to the best design would be much appreciated...I am new to COM & OO programming so any help is needed.
I have a query regarding a business object I am designing. Its the simple scenario whereby I have a database holding products - a simple table - nothing special here.
I want to create a component used by client apps to add or modify to this table. The question is, what is the best design to encapsulate these objects - ie, should one class be the database handling stuff, and another be the product info. Or should i also include a collection class to handle them all.
If having 2 or maybe 3 classes, would you make only one of them creatable, the others being handled by it.
Further, the database is Oracle and requires username/password. The question with this is; if i handle the database connection through one class, then i cannot have the classes initialisation event establish the connection, because i need to pass it this username/password, therefore do I have to have it so that i have another method, say an "initDBconnection" method which the client application must call before doing anything...
I hope that all makes sense, it is more a design question, so ideas as to the best design would be much appreciated...I am new to COM & OO programming so any help is needed.