The Future of CS2

The CS-2 course serves a dual purpose. Its first goal is set by its position in the curriculum, nominally the second semester of a Computer Science education. CS-1 typically introduces programming to students, but at that level they still think of it as an end in itself. It falls to CS-2 to improve their programming skill to the point where they can concentrate on the subject of the problem and the solution techniques.

If students are to pay more attention to the problem than to the programming medium, they need a set of problems to work on. There is, therefore, a perfect opportunity to act upon an alterior motive, and use a problem domain that would have to be taught later anyway. If enough people agree which of the many curricular elements can be used at this level, then it becomes the defacto second purpose for the course. An interesting fact about CS-2 is that its alterior motive not only has become universally accepted, but has displaced the first goal in the course's title, burning the name "Data Structures" into course catalogs across the world.

I hope to see in CS-2's future a revival of the first goal, and a long-overdue update of the programming techniques the course presents. This does not have to take much time away from data structure study -- it will take a couple of weeks to present the modern programming mechanisms, then normal data structure programming will illustrate their advantages. In a semester course, this still leaves plenty of time to cover the linear structures, binary trees, and at least one design of balanced trees, including the performance analyses. There are other opportunities in the CS curriculum to address topics such as graphs (and there are advantages to studying graph theory without spending time chasing pointers around one's program), but where else can we expect students to learn good programming? In a capstone sofware engineering course? That's as useful as taking English Composition in your senior year, after three years of submitting poorly written term papers.

We need to teach good programming techniques, and since data structures are the problem domain, we need to use a good programming methodology that fits them. I favor object-oriented Design by Contract, for these reasons:

  1. The theoretical aspects of object structures and of the corresponding data structures are the same, so the course can acquaint students with the same analytical techniques.

  2. Object-oriented design is intended for creation of components. Object structures are excellent examples of software component libraries.

  3. Design by Contract is a methodology that uses assertions (preconditions, postconditions, invariants) to describe the behavior of objects. It also clarifies the rationale for good design of class hierarchies: briefly, it states that an object of the subclass must be able to stand in for an object of a superclass.

  4. Object structures are themselves best built with class hierarchies. They are an example of how hierarchies of smaller objects can be used to build hierarchies of complex objects.

  5. All of the programming techniques scale up. The road is paved for larger-scale software design.
Jacob Gore, ToolCASE Computing Inc.         jacob.gore@toolcase.com

Owen L. Astrachan
Last modified: Mon Mar 3 23:28:37 EST