An insurmountable difficulty in presenting a programming course . . .

No More First Exercises

©Conrad Weisert
May 6, 2009

NOTE: This article may be reproduced and circulated freely, as long as the copyright credit is included.


The problem

It has become almost impossible to assign a simple first exercise in an intermediate-level programming course. We used to begin a course by asking the students to design, code, and run a subroutine to perform some potentially useful function. Such an exercise would confirm the student's ability to use the compiler and other tools and might expose serious shortcomings in the student's background. Some of them provided opportunities to compare different approaches.

Among the popular numeric choices were:1

There were plenty of non-numeric examples, too—not just the trivial "Hello, World" program.

Why can an instructor no longer assign such exercises? Because thousands of published solutions are easily found on the Internet. A student doesn't need to commit outright plagiarism. All he needs to do is to look at a solution for a few moments and then go off and code his own version. The creative thought process of analyzing the problem and designing a solution need never arise.

What can an instructor do?

For a while we can try to think of examples that are less useful but easily understood. For example: Count the number of 1-bits in a long integer.2 But we soon run out of those.

It's always possible, of course, to present an original problem as long as it doesn't have to be relevant to any practical purpose. But it's hard to defend such contrived exercises to the student, who may lose respect for the course. Why on earth, the student wonders, would a program ever need to convert miles-per-hour to furlongs-per-fortnight?

Object-oriented examples, too

It's not just those simple single-function-plus-driver exercises that we've lost. Now that object-oriented programming is a mature discipline, we can no longer ask the students to design and code a class to represent some familiar abstract data type. Whatever we may assign has already been done and indexed by Google.

Must we give up?

I have to admit that I've contributed to this problem myself. On this web site are various program components, and my book on Object-oriented Computation presents many others.

Is it realistic to hope that students will acquire programming skills by examining and replicating patterns or models? Can we lock them in a room without access to the Internet while they do their homework? Perhaps we're forced to abandon creative design as a course objective.

Several colleagues whose judgment I respect have suggested that we should just give up. Let's just show the students some good and bad problem solutions and ask them to compare them and analyze them critically. Defer the creative design process until students can handle larger, and presumably more original, problems. I'm not convinced, but that may be the only choice.

Any ideas? Let's hear them at cweisert@acm.org.


1—I recently critiziced a recent book for using the "tired Fibonacci series example". The author sharply disagreed, pointing out that Fibonacci series is simply "common knowledge". I suppose practically everything will soon be common knowledge.

2—Now even that strange example has been implemented in Java's so-called "wrapper classes". What's left?

Last modified May 9, 2009

Return to IDI home page
Professional Education articles