From concrete to abstract

Christopher H. Nevison
2004 Companion to the 19th annual ACM SIGPLAN conference on Object-oriented programming systems, languages, and applications - OOPSLA '04  
We describe an assignment for students in a software engineering class or advanced programming class with emphasis on design. In the assignment students are given a program that solves a maze, with a display that shows the steps toward the solution. The given program has three variations of an iterative search (implemented using the strategy pattern), depth-first search, breadth-first search, best-first search (the latter using a priority queue). The students are asked to disentangle the
more » ... -specific aspects of this code from the search strategy so as to define an abstract problem solver that can be applied to any problem fitting the model of step-bystep searching of a solution space. This requires three steps: defining appropriate interfaces that specify the information about the problem needed by the abstract solver, defining the abstract solver to find a solution using these interfaces, and defining the maze problem so as to implement these interfaces. With the abstract solver created, students should also be able to implement other problems fitting this model, such as the word-ladder game or a search in a graph for a Hamiltonian circuit, so that the abstract solver can be applied to them. The assignment demonstrates the power of generalization using abstract classes and interfaces as a bridge between concrete problems and the solution algorithm. This assignment is intended for a course in software engineering or an advanced programming course with emphasis on design. Students should already be familiar with object-oriented programming, inheritance, abstract classes and interfaces.
doi:10.1145/1028664.1028707 dblp:conf/oopsla/Nevison04 fatcat:fahg6bzf7fca5gxutenzznqhoy