From: ckincy@cs.umr.edu (Charles Kincy)
Subject: Pascal first, and *then* C (was: Why should POINTERS be so damn hard to understand ?)
Date: Sun, 30 Aug 1992 21:52:35 GMT
Organization: University of Missouri - Rolla
Originator: ckincy@mcs213c.cs.umr.edu

In article <485@rhlab.UUCP> bkuhn@rhlab.UUCP (bmk Bradley Kuhn) writes:
>In article <l9nl34INNhln@almaak.usc.edu>, ajayshah@almaak.usc.edu (Ajay Shah) writes:
[...]
>> IMHO Pascal is still the best first teaching language I can see.
>
>I think that it is time to switch to C (Wirth would tell us Modula-2 :-).
>Pascal became a first language when it was the most popular language in use.
>C is now the most popular, and it's time as an introductional language has 
>come. Pointers could be held off until a second level course, and then the
>student is not so overwhelmed by the C, since the basic concepts are already
>in place, and the advanced concept of pointers can be more in focus.

I *strongly* disagree.  First of all, there is little you can do in
C without using pointers.  Second of all, Pascal is higher-level and
hides all the aggravations of C from the beginning programmer.  Jumping
into C as a first language invites frustration and disaster.

For example, the string.  In most implementations of Pascal (well,
at least Borland's), a string is a separate data type.  The string
type doesn't exist in C.  In fact, it is a memory area, and must be
treated as such (and treated with respect. =)

(1) For example, in Turbo Pascal you can do this:

foo:  String[40];
[...]
foo := 'Bubba';
[...]
foo := 'Tubby';
[...]

(2) In C, you must do this:

#include <string.h>
char[40] foo;

[...]
strcpy(foo, "Bubba");
[...]
strcpy(foo, "Tubby");
[...]

(3) Try this in C. . .

char[40] foo;

[...]
foo = "Bubba";
[...]
foo = "Tubby";
[...]

. . .and you will get screwed.  =)

To someone who hasn't had any experience programming, (1) is very
straightforward and easy to master.  (2) is extremely difficult
for a novice to understand.  A novice is more likely to try (3), which 
results in severe frustration.

>  Actually, I found it to be quite a let down, after mastering C, to return
>and finish pascal (I learned C on my own, and they made me take the extra
>pascal).  I remember the day in class that pointers were introduced, I thought
>to myself "THAT'S IT!  HOW USELESS!"

May be useless, but far less dangerous for someone who doesn't know
how dangerous pointers can be.

>> If you have not laboured
>> writing x = x + 1; thousands of times, you won't appreciate
>> ++x and x++.
>
>Granted, there is something to be said for that.  I remember first learning
>differential calculus.  We had 40 problems to find derivatives using the
>limit definition.  It took me 4 hours.  The next day, the teacher told us
>to " multiply by the power and drop it one".  I was P.O.'d but I will never
>forget the limit definition of a derivative.

Well, in Turbo you can say Inc(x);  ;)

>That being said, I think that there is a point where we have to give 
>rookies the advantages of our labors.  We don't make First year students in
>CS write assembler code before they are permitted to use high-level languages.

Amen to that!!  There are too few CS people as it is.

cpk