Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I hope I have asked this in the right forum.

Basically, we're designing an Online Store and I am designing the class structure for ordering a product and want some clarification on what I have so far:

So a customer comes, selects their product, chooses the quantity and selects 'Purchase' (I am using the Facade Pattern - So subsystems execute when this action is performed). My class structure:

   < Order >

       < Product >

          <Customer >

There is no inheritance, more Association < Order > has < Product >, < Customer > has < Order > .

Does this structure look ok? I've noticed that I don't handle the "Quantity" separately, I was just going to add this into the "Product" class, but, do you think it should be a class of it's own?

Hope someone can help.

share|improve this question
    
Usually Customers have Orders of your products. –  Robert Harvey Dec 1 '12 at 20:00
    
@RobertHarvey Just seen the mistake, it was a typo :) –  Phorce Dec 1 '12 at 20:03
1  
There's no hierarchy here. Your company has products it sells to customers. It does this through line-item records on invoices which associate a product and a quantity to the invoice. Hold on while I find a sample schema... –  Robert Harvey Dec 1 '12 at 20:03
1  
Something like this: i.msdn.microsoft.com/dynimg/IC210940.gif –  Robert Harvey Dec 1 '12 at 20:05
    
@RobertHarvey Hey that's great :)! Makes more sense, but I only dealing with Ordering a product, therefore I shouldn't really need to consider Customers, correct? –  Phorce Dec 1 '12 at 20:06

1 Answer 1

up vote 1 down vote accepted

Your company has products it sells to customers. It does this through line-item records on invoices which associate a product and a quantity to the invoice. A typical schema might look something like this:

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.