Skip to Main Content
Professional Cairngorm™
book

Professional Cairngorm™

by Jeremy Wischusen
November 2009
Intermediate to advanced content levelIntermediate to advanced
357 pages
8h 20m
English
Wrox
Content preview from Professional Cairngorm™

2.4. The Model View Controller Pattern

As mentioned in the last section, the MVC pattern is generally more concerned than others with how an application is structured than it is in the solution to a particular problem. The general idea is to divide application code into three tiers called the model, the view, and the controller.

The GOF book describes the MVC pattern as follows:

MVC consists of three kinds of objects. The Model is the application object, the View is the screen presentation, and the Controller defines the way that the user interface reacts to user input.

In applications that do not use the MVC pattern, these three tiers tend to be mixed together and scattered across the application. This makes changing any given part of the application more difficult, since to change something like the way that a view represents its data, you may have to update the underlying data. Additionally, the same data may be duplicated across multiple views, requiring each view to be updated.

In addition to splitting applications into tiers, the MVC pattern also dictates how these tiers interact, the responsibilities of each tier, and which tiers have knowledge of the other tiers.

The book Head First Design Patterns (Eric Freeman, Elisabeth Robson, Kathy Sierra, and Bert Bates, O'Reilly, 2004) describes the responsibilities of each tier as follows:

  • Model: Holds the data, state, and application logic

  • View: Presents the data contained in the model to the user

  • Controller: Takes user input and ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Professional Java® JDK®, 6th Edition

Professional Java® JDK®, 6th Edition

W. Clay Richardson, Jeff Scanlon, Donald Avondolio, Mark W. Mitchell, Scot Schrager

Publisher Resources

ISBN: 9780470497265Purchase book