# Model-View-Controller Architecture

##

### Model

The model portion is somewhat self-explanatory. The model should know nothing about the view or controller. It does however usually know about listeners to which it fires notifications (listener-notifier pattern). The model should be changed using `Commands`, and the view should be updated in response to notification.

### View

The view can be several things. It includes the visual part representing a model object(s). The most flexible visual parts are `Figures` from draw2d. GEF also provides support for SWT TreeItems, but support for other visuals can easily be added. While "visual part" refers to an object directly representing a model object, the more encompassing "view" includes feedback, handles, tooltips, and all things visible to the user. All of these make up the view, and it is the controller's job to construct and manage them.

### Controller

The controller is the most interesting part and is the primary focus of GEF. The controller is responsible for:

1. Building the visual part and all parts of the view
2. Modifying the model through Commands in response to user input
3. Observing the model and updating the view accordingly

User input can be a wide variety of things. A part may support multiple, unrelated types of editing behavior. To support this, GEF provides a controller implementation whose entire behavior is provided by plugging in one or more helper objects. This allows for higher code reuse and easier code maintenance.

A controller in GEF is an `EditPart`.