O'Reilly logo

Design Patterns Java™ Workbook by Steven John Metsker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Model/View/Controller

As applications and systems grow, it is important to divide and redivide responsibility so that classes and packages stay small enough to maintain. The phrase model/view/controller (MVC) refers to separating an interesting object—the model—from GUI elements that portray it—the view and the controller. Java supports this separation of responsibility with its OBSERVER mechanics.

The initial versions of the ShowBallistics application combine intelligence about an application GUI with information about ballistics. You can refactor this code, following MVC to divide this application's responsibilities. In this refactoring, the revised ShowBallistics class should retain the views and controllers in its GUI elements.

The creators ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required