Friday, May 14, 2010

Exercise 12

1. 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 4: Use case diagram for a customer using a shopping cart at an online bookstore.

According to the Wiki, the MVC functions are summarized below:
The model is used to manage information and notify observers when that information changes. The model is the domain-specific representation of the data upon which the application operates. Domain logic adds meaning to raw data (for example, calculating whether today is the user's birthday, or the totals, taxes, and shipping charges for shopping cart items). When a model changes its state, it notifies its associated views so they can be refreshed. Many applications use a persistent storage mechanism such as a database to store data.

The view renders the model into a form suitable for interaction, typically a user interface element. Multiple views can exist for a single model for different purposes. A viewport typically has a one to one correspondence with a display surface and knows how to render to it.

The controller receives input and initiates a response by making calls on model objects. A controller accepts input from the user and instructs the model and viewport to perform actions based on that input.
By comparing the MVC to the User Case, the MVC representations are below.

Lookup Books (104)
Model - Lookup Books (Database)
View: - Result of the book searched
Controller - Input of book information to be searched

Add to Shopping Cart (105)
Model - Add to Shopping Cart (Database)
View - Result of the books selected to add in Cart
Controller - Input of book information to be added to Cart

Wiki. (2010). Model-View-Controller. Retrieved on 14 May 2010 from http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

No comments:

Post a Comment