COSC 440                            Large Systems Design                            Spring, 2016

Lab 3: Refactoring and Generalizing

This lab should be done in groups of four. Everyone should have at least two people in their group who were not in a groupwith them last week.


The maze program with the depth-first, breadth-first and best-first (PQ) solutions demonstrates the solution of a single problem that can be done by progressing step by step toward a solution, finding the goal in a maze. Two other examples of such problems are (1) the word-ladder game (where each step is a word that differs from the previous word by one letter) and (2) solving a Sudoku puzzle (where each step is the placement of a number in an empty cell that satisfies the rules). We would like to generalize the maze program to create a system (framework) into which any such problem can be substituted and solved. We do this by refactoring the given solution, as diagrammed for lab 1, into a system where all maze specific information is separate from the solution mechanism. There should be interfaces or abstract classes that the solution mechanism works with, so that the maze specific class(es) can implement the appropriate interfaces and abstract classes to be solved, using any of the three solution strategies.


The purpose of this lab is to design the solution by creating a UML class diagram that specifies the classes needed for the framework and how the maze specific classes would attach to the framework. For a successful design, classes specifying another problem such as the word-ladder or the sudoku puzzle should be interchangable with the maze-specific classes without changing any of the classes in the framework.


A class diagram for the design, with any supplementary explanation needed to clarify the design.

Note 1: the maze uses a state that includes location and direction. A variation of maze could use just the location at each step, and a version like this might be easier to generalize. This is a reasonable modification. In this case, the step from one location to another can be characterized by a pair of locations and these pairs can be used in the part of the program that recovers the path from start to goal.

Note 2: You can simplify the display aspects of the problem, but you should include that facility for displaying the current state in a fashion similar to the bird's-eye view of the maze.