Class Design – Structuring an Online Web Store

classclass-designclass-diagramdesign-patternsuml

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.

Best Answer

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

Related Topic