UML Class Diagram for an E-commerce webSite?

Danial picture Danial · Feb 2, 2012 · Viewed 15.7k times · Source

The diagrams below are my very first attempt at creating a class diagram and the use case diagram describing an E-commerce or Online shopping.

I'm sure its a poor design and full of flaws, but I'm hoping to learn from you guys how you would design it. I'm particularly interested in your use of design patterns and which patterns you would use, how you would implement it in the design, and why.

the use case

Any advise, criticisms, comments and suggestions will be really appreciated. Thanks in advance.


Answer

Kelly S. French picture Kelly S. French · Feb 2, 2012

Impressive and comprehensive, I'd say you're on the right track. I don't see any large missteps that would hold you back from moving on to define your sequence diagrams. My comments below are just an opinion and could be debated either way.

You show an association between the storeList and ProductList, which makes sense if you are traking the same products accross stores with a master list of products, like with a parent company and franchised stores, but it doesn't look like your stores are related in that way.

If you are going to have a class for Currency, go ahead and make Price a separate class. This will make it easier to handle changes to prices, like discounts. Also, you show only 1 currency possible per product, what about selling in multiple currencies? You need to think about the sale transaction as a seperate and distinct domain from inventory. A product itself doesn't have a price stamped on it (typically), it is assigned to it and can be updated, not to mention that the same product could be sold for different prices over time or by different stores. What you need is a stock list that contains attributes for product id, the current selling price, and attributes for whatever discounts might be needed along with a history file that contains all changes to the stock list for when you need to check a price on a sale from the past.

For the same reasons as Price, go ahead and move all product description attributes to a ProductDescription class, e.g. color, size, weight, etc. That way if products have a custom attribute type needed (one store sells both cars and software), you only subclass the ProductDescription class, not the Product class.