classes which form high-level specifications are particularly useful. Students inspect the specification for a non-implementable, abstract class like reproducible in order to determine which behaviours to implement in the specialized classes below. Here again, assertions provide the semantic richness which fleshes out the specification. The ISE Eiffel4 EiffelBench development environment, although idiosyncratic by Microsoft Windows standards, is affordable, and the same source will compile and run on a full range of Unix and Windows platforms. The Project SimOcean The major part of the practical component is centred on a programming project. We are indebted to Richard Wiener for the initial design, SimOcean, which he developed both in C++ and Eiffel [5]. The project is initially presented to students as a complete, running, although rudimentary system. Figure 1 shows the overall structure of the system as produced by ISE’s EiffelCase tool. SimOcean is extremely successful as a student project for a number of reasons. As shown in the figure, the system is structured so that the classes divide naturally into subsystems: the application cluster, comprising the simulation, ocean and location classes; the marine cluster which defines the hierarchy of ocean creatures performing in the simulation; the timing framework, which manages the activation of the ocean creatures; and a small library cluster of utility classes such as random and based_counter. The Ocean is essentially a twodimensional array, wrapped, containing locations which in turn may contain a marine object. Depending on their type, marine creatures can possess the ability to move, reproduce, predate on other creatures, starve and die. The marine hierarchy provides a rich canvas for exploring, understanding and enacting concepts such as abstract specifications (reproducible, predator) for class specialization (adding new marine creatures), and for discovering commonality, generalizing abstractions up the inheritance hierarchy. The timing cluster is a true framework, and is an excellent pedagogical tool for reinforcing many of the software engineering lessons associated with design by contract. Students used to scanning the complete code of a class in order to understand how to use it are initially annoyed that they are expected to use such seemingly complex abstractions as linked_priority_queue without a word of explanation. It takes some time to sink in that the entire timing subsystem is encapsulated from the user’s perspective, with only one routine in class timeable needing to be ‘effected’ in order to make use of the whole framework! We have actually found it more effective to introduce the topic of framework reuse after the students have been through this process. Here too Eiffel proved its value: students find it easy to maintain a “system” view of the software. It is very easy to move to and from a graphical view of the static software architecture and the textual notation, the classes encoded in Eiffel. When the system must be modified, we find that students discover commonality in classes and abstract code upwards in the inheritance hierarchy quite naturally, not hindered by problems such as those associated with virtual classes in C++. The fact that they do so, so readily without prompting, is further evidence of the structural view facilitated by the Eiffel notation.
更多