7

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.


Dan
  • 681
  • 2
  • 11
  • 23
  • You should add the source-files of these diagrams, otherwise it's hard to make improvement suggestions. – hakre Feb 02 '12 at 06:21
  • Do you expect us to decipher your diagrams without knowing what your problem domain is? –  Feb 02 '12 at 13:50
  • Actually , i have not written any code of this php web site, the issue is that usually i just design the Database then i start to write code directly. I have decided for this project to first design the class diagram and usecase diagram then start to write the code. so until now it take one week for me to design these diagrams. i am not sure whether this is correct or not? i need some help – Dan Feb 02 '12 at 14:28
  • @Tichodroma sry i added the functional requirement next answer, since i can not edit my question!!, anyway i appreciated from your prompt action, – Dan Feb 02 '12 at 14:44
  • oh if you want me add any more detail of project please inform me.. – Dan Feb 02 '12 at 14:46
  • Please refrain from adding more info to your question in the form of an answer. From now on, please edit your original question. – jjnguy Feb 02 '12 at 15:00
  • i can not edit my original question, the issue is that my original question has two image, i can not add any things to it since i can not add image to my question ,[reputation must be at least 10], anyway @jjnguy, i have seen you have experience with java, suppose if i want to implement it by java, would you please draw or revise my class diagram for java? thank if is it possible.. – Dan Feb 02 '12 at 15:28
  • oh, if you want to design the class diagram, usecase diagram look like this, plus sequence diagram, Database Design and Wire frame for you (as an expert) it will take how many working days? – Dan Feb 03 '12 at 03:09
  • To those who closed this question, the diagrams in this question are extremely constructive in that they provide an complete enough example to illustrate approaches and pitfalls in a proposed design. Some problems don't rear their ugly head until the scale gets to a certain point and it is hard to discuss without something more concrete than saying, "suppose you have a really large domain diagram...". – Kelly S. French Feb 03 '12 at 13:52

1 Answers1

6

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.

Kelly S. French
  • 12,198
  • 10
  • 63
  • 93
  • 1
    i really appreciate for all of your earnest comments, first of all i admit that my currency is weak, i have not completely analysed it since currently there is only one currency but i put it as a separate entity since for next Version i have to support multiple currency. Also your solution for currency is really good Perfect, but.. let explain look like this, in this design a product can only assign to a store, mean different store can have exactly same product BUT the productID IS not the same, so a product is unique for just an store, look like this i can save i product with one currency. – Dan Feb 02 '12 at 16:37
  • and when i want to show it to the customer, i need to the the main base currency of the product price then by the convert currency rate convert it to the currency of target customer, in your opinion this is correct? @Kelly French, i said is your perfect but can i put it on this way? #Second i accept completely that i must create a ProductDescription class, you are Professional – Dan Feb 02 '12 at 16:44
  • # third: sorry for the second paragraph, "You show an association between the storeList and ProductList," Could you please a little more explain it, i misunderstand this paragraph, if i understand your mean, can i say if each productID has uniquely sell just in one one store(i explain in first comment) the issue is solved or not? Thank you very much – Dan Feb 02 '12 at 16:53
  • @Danial, if each store uses a unique product ID (even for the exact same item) then you don't need to show an association between storeList and ProductList, just remove the link on the diagram. – Kelly S. French Feb 02 '12 at 17:37
  • sorry let me explain it, my English is not perfect, each store has a list of productsID (ProductList), storeList shows the list of all store then when user select an store the productList of that store shows to the customer? is it correct? again you are going to say i remove this association? – Dan Feb 02 '12 at 17:49
  • i means of product look like this, store 1 has product B, and store 2 has also product B, but in this class diagram (specially database) i give 2 different ProductIDs to the two product, as a result each product only refers to just one store, – Dan Feb 02 '12 at 17:52
  • @Danial, storeList is associated with multiple stores; each store has its own list of products. That is how storeList is already connected to Product. The only reason I can see to maintain an association between storeList and Product is if you wanted to have a master list of products where each store uses their own ID for the same product like Product(master_product_id, store1_id, store2_id). Let me ask it this way, will you ever need to get a list of all products for all stores and also have that list only contain unique entries? – Kelly S. French Feb 02 '12 at 21:48
  • oh i have not think about this issue, i got what is you means, it is a good feature but i have not had plan till now to have this kind of list, but it is really useful i will put it on the second phase (version) of this project. oh one more question in you point of view if i want to implement this one with PHP, java or even Objective-c do u have any estimation for each one of this programming language? – Dan Feb 03 '12 at 02:54
  • I revised it.. please have a looked – Dan Feb 03 '12 at 11:49
  • My estimate would be biased because I know Java much better than PHP or Objective-C. Whichever one you already know is likely to be the one that will take the least amount of time. The target platform will influence the language more than the amount of development time. Do you want the app to run on an iOS device with no connectivity? Use Objective-C. Will it be server-based but you don't have a large budget? You'll find PHP more affordable. Do you already know you need to support large scale? If your host supports Java, you'll find Java to scale well for coding and deployment/migration. – Kelly S. French Feb 03 '12 at 14:01
  • you comments are really helpful, actually i am about to implemented by PHP, i have worked with java and objective-c, at the moment for me it is easier to used php since i m more professional in php. Just one more thing, i draw the database diagram and put it into question for more details, would please based on the tables of database somehow comment me over class diagram that i have done? actually i provide 2 class diagram one is Independent from any language and the other class is for php, Thanks – Dan Feb 04 '12 at 08:46