Programming Resources
For Fun and Learning
Charles Cusack
Computer Science
Hope College
main

Python
C++

JAVA


PHP
SQL
Alice

MVC_Ferzle


Description
MVC_Ferzle is a very simple applet that demonstrates one way of using the Model-View-Controller (MVC) design pattern to implement a GUI that has associated data.

In this implementation, the view class contains everything the user can see. It contains both the input and output elements. However, it is totally passive. It does not handle events from it objects, and does not update its objects unless asked to by others.

The controller reacts to user input on the view and updates the model. The model, when updated, informs the view of the update so that it can make any necessary changes.

Of course, this applet could have been much more easily implemented as a single JApplet class. But consider what would happen if the model became more complicated. What if the we wanted to control the contents of an array, or had a list of some sort we wanted to maintain and update? Doing this in a single class would get messy.

We use this simple example because it contains only what is needed to demonstrate the principles of MVC, and nothing more to confuse what is happening.