OOP mapping customer - server
Posted: Wed Aug 23, 2006 9:29 am
Let us say customer bought server(it could be anything really.)
How do you make this connection in OOP manner.
In DB you will probably have server_table with customer_id for each server record to represent to whome this server belongs.
Now taking OOP approache we will try to achive max decoupling...meaning Customer is a customer...server is a server (entities on their own)
How do you translete this in objects so you can easily answer these questions:
- get all servers for customer_id "N"
- get the customer who owns server "Server_Name"
- and other search capapbilities.
And mind that one customer has a lot of stuff associated with it.... there are servers, settings, other stuff. So just having a reference in the customer object to server_objects and vice verse could get very hard to maintain. Or is this normal coupling.
How do you make this connection in OOP manner.
In DB you will probably have server_table with customer_id for each server record to represent to whome this server belongs.
Now taking OOP approache we will try to achive max decoupling...meaning Customer is a customer...server is a server (entities on their own)
How do you translete this in objects so you can easily answer these questions:
- get all servers for customer_id "N"
- get the customer who owns server "Server_Name"
- and other search capapbilities.
And mind that one customer has a lot of stuff associated with it.... there are servers, settings, other stuff. So just having a reference in the customer object to server_objects and vice verse could get very hard to maintain. Or is this normal coupling.