Model view control (MVC)

The model view control pattern can work at different levels.

At a large scale, the model is your database data, the view is how the data is presented on the screen and the controller handles the interaction from the users. In a web application the view is written in JSP or ASP. The controller is the Action or Controller class you write, depending on which framework you are using.

At a much smaller level, MVC works for a single button. The model holds the state of the button: unclicked, clicked, enabled, focused, visible. The view renders this, showing a greyed-out look for a disabled button etc. The controller handles the mouse clicks, so a mouse-down changes the state of an enabled button to clicked (and the view displays the button as pressed.