Wednesday, May 6, 2009

Shopping Cart Web Application - Design - Part 2

Introduction
In this article we define the classes the shopping cart application is going to use. We also build a sequence diagram for one of our use cases.

Before we get started
I created the diagrams using ArgoUML. It is a UML modeling tool that you can download for free. If you download and install ArgoUML you should also be able to open the ShoppingCart modeling project I created.

What we will cover
  • Class diagrams
  • Sequence diagrams

Level
  • Introductory

Class Diagrams
A class diagram is used to describe the structure of a system by showing the system's classes, their attributes, and the relationships between the classes.
Figure 1 – shopping cart class diagram

The Shopping Cart Class Diagram defines the following classes:

1. Business Objects (Domain Model)
A domain model can be thought of as a conceptual model of a system which describes the various entities involved in that system and their relationships. The model identifies the relationships with other entities within the system as well as their methods and attributes.  The following two classes make up our domain model:
  • Basket
  • Item

2. Business Delegate
For simplicity the shopping cart application classes that handle the business logic reside within the web application. Although this is not always the case, more often than not the business logic resides outside of the web application. The Business Delegate pattern can be used to hide the underlying implementation details of the business service, such as lookup and access details. Our application doesn’t apply the business delegate pattern but I do feel it us important to mention it. The classes that handle the business logic are:
  • ShoppingService
  • ShoppingManager

3. View classes
The view classes represent the user interface views of our application. There is also a helper class that manages all the calls made to the Shopping Manager service class. These classes are modeled after the View Helper design pattern: 
  • Items
  • Checkout
  • ShoppingViewHelper
The above mentioned class diagrams are very high level and intended for beginners. I would encourage you to search the web for more in depth tutorials. Here are a few more examples:

Sequence Diagrams
A sequence diagram shows how processes operate with each other and in what order. 
  • The vertical lines in sequence diagrams represent different processes or objects that make up a system.
  • The horizontal arrows are messages exchanged between the different processes and objects in the order in which they occur.
Sequence diagrams are used to look at the behavior of several objects within a single use case. They are useful to identify any architectural or logical problems at an early stage.
I wouldn’t recommend doing a sequence diagram for every use case, only the real important ones.
Figure 2 – find items sequence diagram
Once again I highly recommend you take the time to search the web for further reading as well as for you to apply what you have learnt in your own projects. Here is another introduction to sequence diagrams:

6 comments:

Ecommerce Software said...

Wow it is amazing.I think I should try it into my

Ecommerce Website so that it can get a lot of visitors..
Thanks for this blog.I'll share it with my friends.

Shoppingcart Ecommerceshopping said...

p { margin-bottom: 0.08in; }

Great work dude, u gave nice post to us. Thanks for spending the
time to discuss this, I feel strongly about it.
ecommerce shopping carts



 

Web Application Design said...

Class diagram are very essential for systematic representation. Very well explained.

Ecommerce Shopping Cart said...

Magento Development is the best method to get a personalized wholeheartedly and catchy website. Magento is open source e-commerce design and development platform. It provides quality services for content management. Magento ecommerce activities an answer for anyone who aspires to look up online and make money by selling goods and services on the world wide web. 

Ecommerce Shopping Cart said...

Magento Development is the best method to get a personalized wholeheartedly and catchy website. Magento is open source e-commerce design and development platform.

Alex Walker said...

Wonderful post.... & unique content...  i am very impressed by reading this post... keep it up...

visit my site- Website Hosting & Design