CSC/ECE 517 Summer 2008/wiki3 7 SHOP PAT
Problem Definition
Shopper pattern. The idea of a "shopping cart" is ubiquitous in e-commerce. This idea lends itself to abstraction in the form of a Shopper pattern. Find examples and descriptions that are suitable for teaching this pattern, if possible, including some non-obvious applications. Write up your findings in the form of a narrative.
Introduction
One of the most popular activities on the Web is shopping. Online shopping carts can provide much more than their offline namesakes, such as making it easy to change the quantity of an item in the cart. It has much allure in it that one can shop at ones leisure at anytime. Customers can compare prices with a click of the mouse and buy the selected product at best prices.The shopping cart is a very well known and international metaphor. The main purpose of Shopper Pattern is to assist the consumer to obtain a collection of items from a set of providers which is achieved by introducing low coupling between the consumer and the provider. This pattern allows users to first collect all the desired products and then pay for them all at once or whenever they want. Consumers can easily search through a large database of products and services and see the actual prices including shipping before they decide to purchase.
Participants
- Consumer: Provide a list of items required to the shopper. While viewing the description of the product, the consumer is allowed to add the items to their shopping bag. The user is always shown with the current contents in the bag and also the total cost. In this way, the user is always aware of the cost before hand including the shipping charge.
- Shopper: Accepts the shopping list from the consumer and search for the multiple providers for the respective items. Shopper may search the item on different basis ex: Brand name, lowest price, highest price etc according to the consumers choice. http://www.answers.com/topic/shopper
- Provider: It keeps multiple items and make it available to shoppers. At the same time assist the shopper in locating the other providers. http://www.google.com/search?hl=en&rlz=1T4SUNA_enUS281US281&defl=en&q=define:Provider&sa=X&oi=glossary_definition&ct=title
- ItemRequest: Requested item by the consumer is identified.
- Item: The things that a provider owns, described by an item request, requested by a consumer, and the shopper obtains. http://www.google.com/search?hl=en&rlz=1T4SUNA_enUS281US281&q=define%3Aitem
Implementation
A sequence diagram which illustrates how each objects or processes operate one with another and in what order is given in Figure 1. A wide variety of application implementations are supported by
Shopper pattern. There are two main key issues to implement the shopper pattern.
- Traversing the set of providers: Shopper pattern can be used in multiple situations where
- Providers can be grouped into an aggregate object or arranged in a simple list.
- Aggregate is known by the consumer and stored in a global variable.
- When the providers are arranged as arbitrary graph topologyand one or more providers is known by the consumer and stored as a global variable.
A strategy pattern could be applied to handle these variations. It is achieved by configuring a shopper object that traverse along with the strategy object to locate a set of providers. Strategy object may have some idea about some of the providers or else get the details from the consumer. After locating the providers, the shopper (or traversing strategy) provide an iterator to traverse through the set of providers. A provider is able to create a iterator to traverse the providers and also provides a simple interface(like first, next, current, done to the shopper pattern. In case when providers are arranged in a form of linked topology, each provider support a traversing strategy or iterator that would iterate through the adjacent providers. Infinite looping should be taken care of in case of cyclic graphs.
It is not necessary that the shopper have to traverse all the provider objects. If the strategy for selecting items at a provider is "first found", it is highly possible that the shopper may quit from further proceeding as soon as all the item request has been satisfied.
- Obtaining and Selecting requested items at a provider:It is based on couple of basic principles:
The shopper needs to know about how to obtain the item and does not care when the items are provided by a given provider. The provider has the idea of what items to provide but it doe snot know which item is required by a shopper. The shopper perform the follwing action in order to process the shopping list at a provider. provider is being for th elist of item it can provide. A list is computed which is intersection of the shopping list and th elist of items th eprovider can provide. Ask the provider for each of th eitems in the intersection list.
Steps to remember in designing
- Standard icons and conventions: The icons or a relevant word is a very nice approach to navigatethrough the web sites.The text should be explicit to itself.More than multiple lines of link appears to be two different links. Main links should be attractive and visible that helps user to find easily on the page.
- Avoid irrelevant links: On the page of searching for a books there should not be the links of TV,toys etc.In place of that the links related to books should be there.User may need multiple options to search for a book and require multiple option from where he can order the book.
- Reveal structure: The structure of searching the items should be attractive and user friendly with multiple options.In the book example the structure should provide the otion where user can search on the basis of multiple option.For ex: search by first name, last name,year etc.providing a toolbar option is very relevant idea where user can navigate the site very easily.
- Leave breadcrumbs:
- Don't bury information: The page on the site should not be farther than three clicks away from any other page. For example.For ex : buy the item, jump to related items, search for another item, purchase items in your shopping cart, and manage your account.
- Don't be mysterious: Things on the page should not be hidden.Like when user click somewhere then something pops up and before clicking there was no link or icons to navigate.
- Provide help: There should be help on searching the required pages or facility of keyword search.User should have the adjustable search criteria.
Usage
- Used when one or more products are bought by the consumer.
- Used when one or more instance of a product are bought by the consumer.
- Used when the consumer wants to shop later.
- Used when the consumer wants to pay the total amount later.
Advantages
- Shopper pattern helps in decoupling the requesting object from the object that provide the requested items.
- The responsibilities can be moved for provider objects.the requesting application will not need to be modified.
- The provider objects can be rearranged without modifying the requesting application.
- Optional items can be optimized in such a way that the processing time will be required only if the item is present in the list.