Appendix B. Exercise Solutions
Exercise 1 Solution
An application implemented following the MVC pattern is divided into three components:
Model — This component's responsibility is to retrieve an object from the database and to apply domain-specific logic.
Controller — This is the component that receives the user input, calls the model, and sends data to be displayed by the view.
View — The view simply renders the data that it received from the controller.
Exercise 2 Solution
The Presentation Model is the part of the model that contains the objects that are used only with the purpose of sending data from the controller to the view. This contains the data ready to be rendered by the view without further transformations needed.
Exercise 3 Solution
The main differences between MVC and the MVP are:
With the MVP pattern the requests first hit the view and then flow to the Presenter, whereas with the MVC, the first component being hit is the controller and the view is the last one.
Using the MVC pattern, the various components are standard classes, and they are wired-up together by simple method calls. With the MVP pattern, each view must implement its own interface and must publish some events to which the Presenter must subscribe.
Exercise 1 Solution
Migrating an ASP.NET WebForms application to an ASP.NET MVC application is a broad topic that is covered in Chapter 17. However, it's very helpful for you to think about migration at this point to prepare yourself to understand the ...
Get Beginning ASP.NET MVC 1.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.