This month, Richard Mansfield, senior editor of COMPUTE!, expresses some concerns in this guest editorial about the way programming is taught in schools.
Editor In Chief
Which computer language is best? Ask that question at a computer club and you're sure to start a debate. But computer users rarely have much choice in the matter. If you buy a personal computer, you'll get BASIC. It's usually built into the computer. If you learn programming at school, you'll get Pascal. It's built into the curriculum.
Of course, other languages can be purchased for personal computers and are sometimes taught in schools, but BASIC and Pascal are by far the most common ways that most people are learning to communicate with computers.
Why is it that Pascal isn't built into consumer computers and BASIC is frowned upon by academics? What's the difference between these languages? Is Pascal the easier language to learn? Or is it just the easier language to teach.
The goal of a teacher is to pass knowledge, even wisdom sometimes, to the student. Good teaching accomplishes this transfer with a minimum of damage to the student's creativity and freedom of thought. But like all human activities, teaching can go awry.
On the first day of driver education, the teacher told me and the two young women in my group that we couldn't get into the car until we'd promised to follow the Three Rules of Good Driving. Evidently there had been some hair-raising moments in the past and these rules were for everyone's safety. 1. Keep your eyes on the road at all times. 2. Keep both hands on the wheel at all times. 3. Always use the turn signal, but also roll down the window and signal with your hand too. This last rule struck us as perhaps excessive. For one thing, we'd never seen anyone driving like that. And doesn't rule 3 violate rule 2?
Never mind, that's the way to drive. As the weeks progressed, other strange rules were added: Don't adjust the mirrors or the seatbelt while in motion, never converse with other passengers, and so on. We followed the rules, but of course discovered later that these were not realistic guidelines. Some of what we had been taught were the Rules of Good Driver Education, as distinct from rules of good driving.
I suggest that Pascal is not easier to learn than BASIC. Nor is Pascal more flexible or faster to program in than BASIC. In fact, Pascal has no significant advantage over BASIC save one—it is easier to grade.
That's because Pascal and languages like it stress structured programming. Pascal has more rules than BASIC. For example, in BASIC you can create variables anytime you want to. Just say INCOME = 15000 and that's that. In Pascal, you must define your variables at the start of the program. You must declare whether they're integer, string, floating point, etc.
Another rule associated with Pascal is program formatting: Loops should be indented, each programming event should be on its own line, and subroutines should be set off by additional spacing.
A third rule is possibly the most confining: You are not allowed to GOTO. In BASIC, this command allows you to branch to any other instruction in the program. And you can keep on branching at will. Pascal permits branching, but you must always return to the place from which you branched.
Forbidding GOTO branches is the keystone of structured programming, and it has an important effect on the way a student approaches programming. Before actual programming can begin, the programmer must plan the structure of the program. This is analogous to the requirement imposed by some English teachers that no one should begin writing an essay until they've first constructed a detailed outline. In Pascal classes, flowcharts abound.
Pascal, of course, is not a terrible way to program computers. And BASIC isn't perfect. They differ mainly in the psychological effects they have on programmers. But if the primary virtue of Pascal is that it is the easier language to teach, maybe some questions should be raised. The most important question might be—is Pascal the best language to learn?
What's worrisome about Pascal's emphasis on preplanning and its blizzard of rules is that such academic programming might be the only experience many people will ever have with computer programming. They might assume that all computer languages are restrictive. They might never go on to discover that communicating with computers can be an exceptionally rewarding, even entertaining, pastime.