views:

139

answers:

3
A: 

If you are trying to desing a database, I'd do it that way :

Companies = [id, name]
Contacts = [id, name]
Products = [id, name]
Adresses = [id, details]

CompaniesContacts = [contact_id, company_id]
CompaniesProducts = [product_id, company_id]
AdressesContacts = [contact_id, address_id]

References = [contact_id, referenced] // referenced is also a contact_id

Also, I'd recommend using UML. It's just a quick answer, try to update your question and I'll update it a bit.

marcgg
The database is legacy and cannot be changed at this point. We are attempting to create business objects We were hoping to find someone who may have come across a proven design pattern or two (or tried and true object models) for this. The flow diagram was simpler in design - we don't want to propose solutions just the problem/question
Steve Bargelt
A: 

We have a similar structure in our application and it works well for us. We have two extra tables

We have the concept of Sites between the company and addresses people can be attached one or more sites in our schema and that saves storing thousands of duplicate addresses. You could reference the client address direct in an addressbook too.

Where are you storing contact details ?

u07ch
u07ch, thank you. The tables appear to be in good shape (properly normalized). Our concern is primarily with the business object area of our project.
Steve Bargelt
+1  A: 

You can use the following object model:

Organization
-id
-name
-description
-productLines ( collection object consisting of products)
-orgcontacts ( collection object consisting of contacts)
-addresses (of type Address, can be a collection depends on business rule)

Contact
-id
-name
-type (Business, personal, etc)
-parentID (null if no reference)
-adresses (Address or collection)

ProductLine
-id
-name
-prLineContacts ( collection object consisting of contacts)

You can build on this basic model that I can think of. Do you have a data schema? if so, you should decide where to start. Some people like 1-1 mapping between their object and data model and some want to design their data schema based on performance and then have another abstraction mapping between objects and database.

CodeToGlory