Also Known As


Brief Description

Several problems can arise when applications contain a mixture of data access code, business logic code, and presentation code. Such applications are difficult to maintain, because interdependencies between all of the components cause strong ripple effects whenever a change is made anywhere. High coupling makes classes difficult or impossible to reuse because they depend on so many other classes. Adding new data views often requires reimplementing or cutting and pasting business logic code, which then requires maintenance in multiple places. Data access code suffers from the same problem, being cut and pasted among business logic methods.

The Model-View-Controller design pattern solves these problems by decoupling data access, business logic, and data presentation and user interaction.

Detailed Description

See Model-View-Controller explanation of this architectural pattern

Detailed Example

The architecture of the Java Pet Store sample application website applies the Model-View-Controller design pattern. Other design patterns are combined in the design of the MVC architecture.

Class Diagram Showing Sample Application Architectural Components

The architecture of the Java Pet Store website is described in more detail in the Java BluePrints Program book [ SSJ02 ]

Often, MVC functionality is captured in a framework that is reused by different applications. The sample application Web Application Framework is an extensible framework for creating MVC applications. It is an implementation of MVC to which new data sources, business logic, and data views may be added.

Copyright © 2002 Sun Microsystems, Inc. All Rights Reserved.
Left Curve
Java SDKs and Tools
Right Curve
Left Curve
Java Resources
Right Curve