Model-View-Controller Pattern

Amruth Kumar
Ramapo College of New Jersey
 

A Java Course Module featuring:

This exercise introduces the Model-View-Controller pattern. This pattern, henceforth referred to as MVC, separates the logic of a program from its User interface. Therefore:

Introduction

The particular problem used to illustrate MVC is a simple calculator:

Web Resources

Due to the simplicity of this problem, and students' familiarity with the functioning of a calculator, students can focus on MVC through this project. As a "starter",  the following code is provided for examination, extension and debugging: Students may be asked to study this code before the lecture in the following ways:

Lecture Outline

  1. Introduction to the Java event handler, and at least TextField, Button, Label, and Panel components
  2. Introduction to patterns
  3. The MVC pattern, and its advantages, that MVC is a major motivation for Java Swing classes, and how this puts "problem solving" back into programming!

In-Class Exercises

 

Take-Home Exercises


Pedagogical Patterns:

This exercise involves the following pedagogical patterns: