Friday, May 28, 2010

Exercise 12: Modelling with UML or MVC?


Examine the Use Case in Figure 4 and explain the MVC architecture of the online bookstore (the model the view and controllers) needed to Lookup Books and Add to Shopping Cart.


Figure: Use case diagram for a customer using a shopping cart at an online bookstore.

Lookup Books (104)
Model: Online bookstore database, which contains all of the required information about the book as well as information on the current inventory status.
Views: Book search form, Book Search Result Page
Controllers: BookSearch() -  method containing algorithm that utilizes information entered on the form to search the database for hits and returns them if any.
Customers input search strings in the Book Search page.
The Book Search Controller passes the searching criteria to Lookup Books for processing and redirects the display to Book Search Result page.
While rendering of the view, Model will be requested to display the search result. 

Add to shopping Cart (105)
Models: Customer & Orders Table in the database. Customers table will hold all of the relevant information about the customer, whereas the Orders will contain Information about the orders in relation with a particular customer.
Views: Shooping cart List
Controllers: CartManager() - method containing functions to add/edit remove entries to the shopping cart.
Customers input books information in the Add to Shopping Cart page.
The Add to Shopping Cart Controller passes the book information to Add to Shopping Cart for processing and redirects the display to Shopping Cart Result page.
While rendering of the view, Model will be requested to display the result.

No comments:

Post a Comment