^{©}Conrad Weisert

May 6, 2009

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

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}

- Decompose an integer into its prime factors.
- Find the greatest common divisor of two integers.
- Evaluate a function from a table using linear interpolation.
- Compute the area of some plane figure.
- Compute the great-circle distance between two points on a sphere.

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.

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?

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`

.

^{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