Using Patterns: Design and Implementation of Hangman

Hangman

A Simple, Procedural Version of Hangman

This program will set the stage for a more object-oriented version incorporating patterns. We start with a 150-line, one class Hangman.java program that's (hopefully acknowledged as) a reasonable attempt at a procedural decomposition of a simple Hangman game.

First pass at an Object Oriented Version

This program is object oriented with several classes and some patterns employed to address problems in the first, procedural version. This version is text-based, but the first step toward a graphical version of the game. There are still problems in this version, but it provides a context for a discussion of object oriented concepts and the use of design patterns.

UML diagram of code

Second pass, uses MVC Observer/Observable

Note: I'm using Java's observer/observable interface/class here. This is a little cumbersome, but it exploits what's already in Java. It might be worth providing a cleaner observer/observable implementation, that's on my todo list.

UML diagram of code

Gui Version, Extending MVC

The UML and studying questions are coming. I also need to do some refactoring, but the main ideas are ok here (I hope).


Owen L. Astrachan
Last modified: Fri Nov 17 12:05:09 EST 2000