1

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.

7
  • Usually Customers have Orders of your products. Commented Dec 1, 2012 at 20:00
  • @RobertHarvey Just seen the mistake, it was a typo :)
    – Phorce
    Commented Dec 1, 2012 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... Commented Dec 1, 2012 at 20:03
  • 1
    Something like this: i.msdn.microsoft.com/dynimg/IC210940.gif Commented Dec 1, 2012 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
    Commented Dec 1, 2012 at 20:06

1 Answer 1

3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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