CS 204: Software Design

MVC with a very simple M

Of all the patterns in our Design Patterns book, the one I run into most often in my day-to-day programming life is the Model, View, Controller (MVC). In this assignment, you will implement a simple example of the MVC architecture, using several of Java's graphical user interface elements.

Your program from the user's perspective.

When you launch your program, a window will open, showing four controls: a spinner, a slider, a text box, and a thermometer of your own design. Each of these four objects will represent the same integer between 0 and 1000. At startup, the integer will be 500.

If you click on the thermometer at the height of, say, the integer 245, the text box, spinner, and slider will all change to match 245. If you type a new integer in the text box, or slide the slider, or spin the spinner, the other three controls will change to match you as you type, slide, or spin. At any given time, all four controls will reflect identical integers.

What to hand in

Hand in source code and a readme. The readme should explain your class design, your command-line syntax, and the status of your program.

Notes and suggestions

We will be doing another round of code reviews with this program, but not a rewrite.

Some suggestions:

Are you crazy?

If you have tons of spare time and are dying to do something fancier, you can replace "integer" with "time of day" in your model and your views. In this case, the thermometer would become a circular analog clock, the text box would become a pair of text boxes with a colon between them, etc. Doing this version won't be worth more points, but if you want to spend your time figuring out how to drag the hands of a clock around with a mouse, go right ahead.