[Texas PLT logo]

COMP 202: Principles of Object-Oriented Programming II

  Hangman Refactored  

Homework #4: Hangman Refactored

Deadline: See Owlspace for due date.

Please note our README Guidelines and our submission instructions.

In Homework #1 and #2, you developed a Hangman game using the Model-View-Controller (MVC) design pattern. One of the benefits of the MVC pattern was that model and view were loosely coupled, and that the model or the view could be changed easily without impacting the other part very much.

We never actually proved this. In his paper OOP and the Janus Principle (cached locally), Joel C. Adams describes what he calls the Janus principle:

Design and write object-oriented applications so that they support multiple, reuseable, user interfaces with minimal redundant coding.

Adams argues that requiring multiple views (or models) forces developers to abandon the tight coupling that might still be there even if MVC is used. This is the reason the Temperature Calculator had multiple views.

In this assignment, you will apply what you have learned from the Programming for Change lecture and the Temperature Calculator assignment to the old Hangman game. In particular, you will write a second view that uses the console for text input and output, and change the MVC architecture of the original Hangman game so that the controller and the model do not have to be changed for either view.

Most likely, you will find that your original implementation and even our solution to the Hangman homeworks were not as good as we all thought. We used the MVC pattern, but model and view were still rather tightly coupled. But really, that is to be expected: Object-oriented development and refactoring requires several incremental passes, and a perfectly decoupled system is still inachievable. Even experienced developers don't write perfect solutions. Don't let that stop you from writing a first implementation, and then come back to improve it.

Click here to run a demo of the Hangman Refactored project!

We have also provided you with stub code to give you a fair start, independent of your previous homeworks.

Here are the specifications for the refactored assignment, as well as some hints:

  Hangman Refactored  

URL: http://www.cs.rice.edu/~javaplt/mgricken/teaching/202/08-fall/hw/hangman.re/index.shtml
Copyright © 2008-2010 Mathias Ricken and Stephen Wong