Fixer Upper

Contributed by:
Joseph Bergin
Pace University
One Pace Plaza
New York, NY 10038 USA
berginf@pace.edu

NAME
Fixer Upper

INTENT
To introduce students early to larger problems than they can develop themselves. To give students skill at critical analysis. To introduce error analysis and correction

IDEA
Fixing a larger artifact than can be created by students is generally within their grasp. It gives them a better sense of scale of interesting problems and permits them to integrate a number of issues into the solution of a single problem.

MOTIVATION
Students can benefit from seeing larger problems than they can solve at their current state of development. They also need critical analysis skills and the ability to evaluate programs, designs, etc.

APPLICABILITY
The pattern can be used in several courses and at several levels. It can be used very early in programming courses and in teaching analysis and design. It can also be used to show the overall structure of a solution methodology.

CONTRAINDICATIONS
None.

STRUCTURE

Students are given an artifact, such as a program or design. The artifact proposes to be the solution to a problem, but while generally correct, the instructor has purposely introduced flaws into the program, design, or whatever. The artifact should be fairly large and should contain a number of flaws. Most of the flaws should be simple and obvious to most readers. There should be one or two deeper flaws.

Students are asked to find and correct the flaws. They can also be asked to discuss the nature of the flaws found and the reasons for their changes.

CONSEQUENCES
This pattern allows students to actively work with larger solutions than they can develop completely themselves. They benefit since finding flaws in their own work is a valuable skill. In programming, students see lexical, syntactic, and semantic errors. In design, they can see the effect of incorrect partitioning of responsibility.

ISSUES TO CONSIDER
It is important that the overall structure of the artifact be sound. If it is a program it should be well designed and written, with good choice of identifiers. If it is an analysis or design document, its overall structure should be sound with a clear map to the problem statement.

The best way to develop such an artifact is to start with an excellent solution to a problem and then doctor it by introducing flaws.

Follow up. Most such exercises cause the students to generate questions that can be a fruitful source for classroom discussion. If the instructor is careful to introduce certain flaws, the student can be led in a desired direction to further explorations.

CULTURAL DEPENDENCIES
None.

RESOURCES NEEDED
A problem and a well designed and implemented artifact that you can manipulate to provide the necessary errors.

EXAMPLE INSTANCES OF THIS PATTERN
This pattern has been used to teach:

1. Beginning programming. Here the artifact is a program illustrating a number of syntactical constructs that have not yet been introduced in class. (It has been used as the first assignment.) The program can be large enough that its structure is not obvious. Two or three classes with several short methods each is about right. One part of the program might be more complex. Together with the driver, there should be three or so pages of code. The errors can be mostly syntactical and lexical, so that the compiler can find them. One or two semantic errors should also be introduced, so that the program does not perform as expected. More serious and perhaps for more advanced students is the failure to fulfill a precondition contract. Ten to fifteen errors is about right if most are easily caught.

Even a single class can be introduced that has a flawed public interface. Students can be asked to analyze the consequences of this in relation to the likely current and future use of the class.

2. Introduction to design. Here a problem is presented and a design for the solution. Six to ten major elements in the design is about the right scale. The design should have a few simple flaws, such as missing message paths or missing functionality within a class. Improper partitioning of responsibility in a small region of the design is relatively easy to introduce. One subsystem could be left out. If the design requires several documents, there might be an inconsistency between the documents. Five or six flaws is probably enough.

RELATED PATTERN
None

Spiral

Contributed by:
Joseph Bergin
Pace University
One Pace Plaza
New York, NY 10038 USA
berginf@pace.edu

NAME
Spiral

INTENT
To introduce topics to students without covering them completely at first viewing so that a number of topics can be introduced early and then used. This can get students working on interesting problems earlier as they have more tools to use, though they have not, perhaps, mastered any of the tools. The instructor can then return to each topic in turn, perhaps repeatedly, giving more of the information needed to master them.

IDEA
This pattern results in the topics of a course being more fine grained, with just enough of a larger topic introduced at each stage to permit problem solving with other tools/topics which are also, as yet, not completely covered. For example, "iteration" is a big topic. The "while loop" is a small topic, especially if initially introduced with only simple loop tests. Yet the while loop can be used effectively with other constructs to build meaningful programs before iteration is understood in all of its aspects.

MOTIVATION
Many fields can only be mastered by individually mastering a large number of different techniques that must interact. Students can get bored, however, if too much time is spent on details of one topic or tool while the big picture is not shown to them, and exercises are artificially contrived to illustrate arcane details.

APPLICABILITY
This pattern can be used in several courses, primarily at the early stages of the curriculum. It can be used (at least) in programming courses, analysis and design courses, and special courses in object technology. A variation of this pattern is often used in the compiler construction course.

CONTRAINDICATIONS
This pattern cannot be used in a small way. A commitment needs to be made to it. If this is not possible or desirable, avoid it entirely.

STRUCTURE
To start, the instructor should extract a subset of the material covering several topics that interact. Only simple cases should be introduced at first. The instructor and class move quickly through the topics until an understanding of how the topics interact can be gained. Students then can work with the tool subset on problems. Then more of each of the original topics, with perhaps simple cases of new topics are introduced to deepen understanding of the topics and of their interactions. Students then work on a richer set of problems. This can be repeated as often as necessary.

CONSEQUENCES
Students will get a feel earlier for how the pieces fit together. A potential negative consequence for some students, at least, is that some of their questions (What if...?) may need to be deferred.

ISSUES TO CONSIDER
The instructor must extract subsets of each of the many topics in which the tools introduced can work together in problem solving. Several, increasingly large subsets, must be designed. Problems using most of the features of each subset need to be designed. One way to design the subsets is to start with the problems and extract a minimal set of tools necessary to solve that problem and similar problems. The next larger subset can often be designed by thinking about how the original problem could be expanded and its solution generalized.

CULTURAL DEPENDENCIES
None as yet targeted, though this pattern may well work better with some students than with others.

RESOURCES NEEDED
The instructor needs a plan, showing the order in which the topics will be introduced and what will be deferred to later cycles.

EXAMPLE INSTANCES OF THIS PATTERN

This pattern can be used to teach low level programming structure. For example integer data, assignment statements and simple forms of if and while can be introduced. Problem solving using these topics only can be introduced allowing students to solve simple programming problems. In the second cycle, more can be discussed on each of these topics (else clauses, infinite loops,...).

In analysis and design, simple analysis techniques and tools can be introduced (simple use-case) and then the class can move to simple designs (CRC cards). Students can thus get a feel for the whole process, solving simple problems. The second cycle can introduce simple features of more sophisticated tools as well as somewhat more complex problems.

In object technology courses, simple inheritance can be introduced an used before polymorphism (dynamic binding) is discussed.

RELATED PATTERN
Early Bird

Mistake

Contributed by:
Joseph Bergin
Pace University
One Pace Plaza
New York, NY 10038 USA
berginf@pace.edu

NAME
Mistake

INTENT
To have students learn the effects of errors explicitly.

IDEA
Students, like professionals, make errors. Professionals generally know what the indications of an error are, but students do not. Use of this pattern explicitly teaches students how to recognize and fix errors. We ask the student to explicitly make certain errors and then examine the consequences.

MOTIVATION
We usually help students avoid errors, but they occur anyway. Students should have a way to explore the effects of errors so that they can recognize them by their effects.

APPLICABILITY

This is very applicable to the early stages of learning programming. Syntax and semantic errors are frequent and students need to become familiar with the messages produced by compilers and run-time systems and what they indicate about the program.

The pattern could also be used in an analysis or design course in which certain specific, but fairly common, errors are required to be part of the design. The instructor can provide a part of the design which is flawed in some way and the students are asked to complete the design without changing the instructor's part. (See the Fixer Upper pattern also.)

This pattern is often used in Database and Operating Systems courses where the students are asked to explore the conditions leading to deadlock, by specifically causing it. Similarly, in learning concurrent programming, students are often asked to write programs in which race conditions between processes lead to the corruption of data.

One especially useful technique is to ask students to make errors that, when they occur accidentally, are especially hard to diagnose.

CONTRAINDICATIONS
This pattern can be over used. It is best used early.

STRUCTURE
Students are given an assignment in which they are instructed to create and run a program with certain specific errors. They are then asked to comment on the diagnostics produced and/or why no diagnostics were produced for the error.

CONSEQUENCES
Students become more familiar with errors and how to correct them. Having seen specific errors, they can learn to avoid making them in the first place.

ISSUES TO CONSIDER

The instructor should carefully prepare exercises using this pattern and be sure to do the exercise before the class does, so that unanticipated occurrences can be prepared for and explanations of precisely what happened can be provided later.

Follow up. It is important that the students get a chance to discuss interesting things that occur while making these errors.

CULTURAL DEPENDENCIES
None.

RESOURCES NEEDED
Knowledge of common errors.

EXAMPLE INSTANCES OF THIS PATTERN

Several were given under Applicability, above. In addition, this pattern can be used effectively to teach students about pointers in languages like C or C++, by having them make all of the common pointer errors purposely. This particular use is somewhat dangerous on computers that have memory mapped i/o and unprotected operating systems.

One exercise from an old book, now otherwise forgotten, was to write a program that produced every diagnostic mentioned in the manuals for a given (Fortran) compiler. This is, not surprisingly, very difficult to do. Impossible, for some compilers, as the documentation and the compiler are not completely parallel.

RELATED PATTERN
Fixer Upper

Early Bird

Contributed by:
Joseph Bergin
Pace University
One Pace Plaza
New York, NY 10038 USA
berginf@pace.edu

NAME
Early Bird

INTENT
To teach the most important material, the "big ideas," first (and often). When this seems impossible, to teach the most important material as early as possible.

IDEA
Students need to see where they are headed. They need to see that detail presented early in the course will relate to important ideas. Here we order class topics in order of importance and find ways to teach the most important ideas early.

MOTIVATION
Students often remember best what they learn first. This can be both positive and negative, of course. Important (big) ideas can be introduced early, even if they can't get complete treatment immediately.

APPLICABILITY
This has very wide applicability to almost every domain. If design is more important than programming, then find a way to do design as early as you can. If functions are more important than if-statements in programming then do them first. If objects are more important than functions, then do them first.

CONTRAINDICATIONS
It may be a mistake to try to use this pattern with material that has clear prerequisite ideas to the important ideas. This would be especially true if the relationship between the prerequisite idea and the big idea is especially subtle or if the prerequisites are especially difficult to master.

STRUCTURE
A course is mined for its most important ideas. These ideas become the fundamental organizational principle of the course. The ideas, and especially their relationships are introduced at the beginning of the course and are returned to repeatedly throughout the course.

CONSEQUENCES
The most important things in a course or curriculum receive more focus from the instructor and the students. Students can be made more aware of what is paramount.

ISSUES TO CONSIDER
Implementation is difficult. Often only simple aspects of an important idea can be introduced early. Sometimes it is enough to give important terms and general ideas. Some "big" ideas are thought of as advanced. It is difficult to introduce some of these early. Hard thought and preparation are needed. Sometimes a really big, but difficult, concept can be introduced incompletely. Then as other material that relates to it is covered, the relationship to the big idea is carefully explored.

CULTURAL DEPENDENCIES
Professors need to be able to analyze deeply what are the consequences of developing material in a particular order. It is often helpful here to have a forum in which ideas can be discussed and refined. It is also often necessary to develop your own materials, which requires time and effort.

RESOURCES NEEDED
Time and deep thought. Discussion groups with other educators who share similar ideas about the most important concepts in a domain are very helpful.

EXAMPLE INSTANCES OF THIS PATTERN

Teaching objects first (or at least early). Teaching design first. Teaching concurrency first in operating systems. Teaching user requirements first in Database. Teach recursion before loops. Of course, these are my definitions of what is most important. You may disagree, but then it is your course, so discover and implement your own "firsts."

The book Karel the Robot, by Richard Pattis was designed with this pattern in mind as a way of teaching procedural programming (procedures first). Its successor, Karel++, attempts to do the same with Objects (classes first).

RELATED PATTERN

Spiral. Some things can only be taught when tightly coupled to other things. Spiral can help here.

Lay of the Land can be used to show the students an example of a big idea in action.

Note: This pattern is actually recursive, as patterns themselves are a really big idea.

Toy Box

Contributed by:
Joseph Bergin
Pace University
One Pace Plaza
New York, NY 10038 USA
berginf@pace.edu

NAME
Toy Box

INTENT
To give the students broad historical and technological knowledge of the field by letting them "play" with illustrative pedagogical tools.

IDEA
Student exercises are chosen to give the students a rich set of experiences about what can be done and what is important in computer science. These exercises are supported by a library of instructor provided materials that make learning fun.

MOTIVATION
While we are teaching programming, it is nice to let the students program with things that will teach them some simple ideas from courses that they will encounter later in the curriculum. Some of these things are complex, but with appropriate scaffolding, even beginning students can use and extend the tools appropriately. Students have to program with "something." Often it is just integers and floats at the beginning. It could be things more exciting to them and which teach them on a variety of levels simultaneously.

APPLICABILITY
The pattern can be used in several courses and at several levels. It can be used very early in programming courses and in teaching upper level courses as well.

CONTRAINDICATIONS
This requires a fairly long lead time and a lot of effort on the part of instructors, creating and finding materials. Don't try to use this pattern without commitment of time and resources.

STRUCTURE
Students are given a library of classes that can be used to implement some complex functionality. These are the building blocks. They then use them to build some artifact. Instead of programming with integers and arrays, they program instead with logic gates, for example.

CONSEQUENCES
This pattern allows students to actively work with larger programs than they can develop completely themselves. If the tools are chosen correctly, they can also gain breadth of understanding of the entire field. If the class hierarchy is well built it also serves as a good model for students building their own classes and hierarchies later, though the intent is not to teach OOP specifically.

ISSUES TO CONSIDER
The instructor distributes a class library that implements the basics of some functionality. The students may either use this unchanged or extend it and use the extended version to build some project. Care must be taken that the hierarchy is soundly built, demonstrating excellent techniques, and excellent structure.

CULTURAL DEPENDENCIES
None.

RESOURCES NEEDED
Fairly rich hierarchies of classes implementing the tools. This is labor intensive, but resources can easily be shared.

EXAMPLE INSTANCES OF THIS PATTERN

A set of classes that implement logic gates and circuits. Gates can be connected together to form circuits.

An assembly language simulator that lets students get familiar with goto/register programming without all the details of a real machine.

An extension to the above that shows some of the problems with concurrency. A set of classes that let students experiment easily with readers/writers conflicts, for example.

A simple game with complete information that plays against the user but learns from its mistakes.

A simple spreadsheet like program. The program can store "programs" in cells using the simple assembly language of earlier "toys".

A set of classes implementing a simple relational database that can be queried with a simple language.

Decker & Hirchfield's Analytical Engine was a good use of this pattern.

RELATED PATTERN
None

Tool Box

Contributed by:
Joseph Bergin
Pace University
One Pace Plaza
New York, NY 10038 USA
berginf@pace.edu

NAME
Tool Box

INTENT
To let the students build a tool kit in early courses for use in later courses. If well thought out and guided, it can be a wonderful guide to reusable software. Students become apprentices in the same sense as young people once served as apprentices in medieval guilds. There they spent their early years building tools they would need if they were to achieve master status in the guild.

IDEA
Students build things in early courses that will actually be used later in the same course and in later courses as well.

MOTIVATION
Students in later programming courses make use of knowledge from earlier courses, but in the past made little use of the actual programs built there. Having a personal tool kit of reusable software components can be a wonderful help in a difficult project. Building the tool kit stresses different, but important, skills.

APPLICABILITY
The pattern is used most heavily in the early programming courses, especially the data structures course. However, it can be added to as well as used in later courses such as database, AI, operating systems, compilers, and the like.

CONTRAINDICATIONS
Not for use in theoretical or "concept" courses.

STRUCTURE
Student exercises have multiple parts. One part of each exercise is to build a general tool that might be useful in other projects and to take some effort in its proper formulation for reuse. The design for reuse must be explicit and must be discussed by the students and commented on by the instructor. Groups of students can combine individual designs of the tools, discuss the relative merits of each and then build a common implementation that improves each of the individual designs.

CONSEQUENCES
Students gain skill in the early courses building reusable components. To the extent that they fail, the lessons are reinforced in the later courses when they need to rebuild parts of the tool kit for use in the projects of those course. Languages supporting reusability need to be used. Most of these languages are either object-oriented or functional. Scheme, C++, Eiffel, Java, Ada are good choices. There are a few others such as Modula 3, Beta, Oberon, CLOS, and Standard ML. Languages supporting genericity (templates) are especially useful.

ISSUES TO CONSIDER
Instructors can provide some tools (data structures and algorithms) in the form of class hierarchies or other libraries. Students complement this collection. Time should be spent by students and instructor evaluating student built tools for correctness, of course, but also for the potential for reusability. Instructors in later courses must be aware that students have these personal tool kits and should use exercises and projects that exploit the tool kits and permit their extension.

CULTURAL DEPENDENCIES
Coordination with later courses is an important element of this pattern.

RESOURCES NEEDED
Thought needs to be given in the design of the early courses as to what tools are broadly useful, but especially which tools will necessarily be useful in later courses. Thought should also be given to platform independence of the tools. The instructor needs a plan and must be able to provide implementations of those tools that the students will need, but will not build themselves. For example, the instructor can give a singly linked list and have students build a doubly linked list. Both would be included in the toolkit.

EXAMPLE INSTANCES OF THIS PATTERN

Kernighan & Plaugher's Software Tools books were a good use of this pattern. This book should probably be read by anyone who wants to implement this pattern. It shows how a high degree of reusability can be achieved with extremely simple tools.

Many data structures, with only slight modification, could be taken as early examples of this pattern.

RELATED PATTERN
Fixer Upper can be used by the instructor to provide partially flawed tools for the students to comment on and repair.

Lay of the Land

Contributed by:
Joseph Bergin
Pace University
One Pace Plaza
New York, NY 10038 USA
berginf@pace.edu

NAME
Lay of the Land

INTENT
To give students some early experience in examining a large artifact, beyond their ability to produce, with the intent of showing them the complexity of the field they are about to study.

IDEA
Students are given a large artifact to examine early in the course. They can see what it is that they are supposed to be about in that course and what kinds of things they will be expected to master.

MOTIVATION
Teaching is often incremental, with topics introduced one after the other. Students need to see the big picture too as well as the detail. Early on, they can produce only simple artifacts, but they can examine, if only in a superficial way, a complex artifact. Seeing the big picture can give them motivation for the study of the parts as they have an idea of how they might be used.

APPLICABILITY
This has very wide applicability to almost every domain. It is especially useful in teaching topics with a lot of parts that must fit together in certain ways. Teaching programming is one example. Teaching design methodology is another.

CONTRAINDICATIONS
None.

STRUCTURE
Students are given an artifact at the very beginning of a course that has about the complexity of the thing you would like them to be able to produce at its end. Time is spent examining the parts and their interactions. Time can be spent on trade-offs inherent in the design or not, but the notion of design tradeoffs should be mentioned at least. The artifact should include most of the elements that are the proper study for that course. It is good if the artifact have some subtle points. If questions arise initially on these points they may be deferred, but it may mean you have better students than you think. The artifact can be returned to throughout the course and the subtle points revealed and discussed.

CONSEQUENCES
Students get to see a target for their study. They also have a model on which they can base their own work.

ISSUES TO CONSIDER
The artifact must be prepared ahead of time. Student projects from prior years are a good source, though they may need to be modified somewhat to emphasize points the instructor believes most important. If these are large, a good way to transmit them to students is via the Internet, especially the Web. This way other educators can use them also.

CULTURAL DEPENDENCIES
None.

RESOURCES NEEDED
Good solutions to larger projects.

EXAMPLE INSTANCES OF THIS PATTERN

A large Object-Oriented program with a few classes interacting in an interesting way is a good choice in a first programming course using an object-oriented language. A complete design with many documents can be used in a systems design course. A complex database design with entity relationship charts and tables can be used in a database design course.

Some compiler course instructors give the students a complete compiler for one language and then ask them to provided a compiler for another over the course of the term.

RELATED PATTERNS

Spiral Some things can only be taught when tightly coupled to other things so Spiral can help here. This can also be the beginning of the first spiral.

Fixer Upper. If the artifact is flawed it becomes a Fixer Upper.

Early Bird. Complexity and integration of parts is one of the big ideas that Early Bird is trying to get across.