Leading beginning programmers astray in their first course . . .

Getting off to a Bad Start
© Conrad Weisert, Information Disciplines, Inc., Chicago
4 February 2014

NOTE: This document may be circulated or quoted from freely, as long as the copyright credit is included.

Too many examples that textbooks and canned tutorials show to beginners illustrate practices that we certainly don't want students to emulate. A knowledgeable instructor has to apologize to a classroom:

"That's just to show how it works. Of course, we'd never actually do that in a real program."

And if the instructor isn't highly knowledgeable, the students are left with the memory of a badly flawed model that they think they should imitate in their later assignments.

Those practices don't necessarily fail in the utterly atrocious category. They just do things that violate well-established principles of good programming practice, such as:

Defenders of publishing those bad practices often argue that it's too early in an elementary course to present more enlightened techniques. Beginning students don't yet understand subroutine linkage, they point out, so early examples must show all the code in a monolithic main program. Beginners haven't yet mastered localizing data definitions, so examples must repeat literal values wherever they're needed.

Nonsense! Those arguments might apply in the first hour or two of a beginning programming course, but by the time students have done a simple exercise or two to confirm their grasp of the stored-program concept, they should be ready to start learning about modular structures and other good practices.

And even when we're sure the students aren't ready, why not at least append a footnote to the bad-practice examples to prepare the students for some future unlearning?

NOTE: The above example shows how [topic] works, but is not a recommended technique because [explanation of why it's harmful].   As we proceed through the course, we shall examine far superior techniques and apply them to similar problems.

An introductory course or textbook should never serve as the source of a future programmer's bad habits.

Last modified February, 2014

Return to IDI Home Page
Return to Education articles