[comp.lang.pascal] first-year programming language

ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (06/14/90)

Currently, the CS department of RMIT uses Pascal in the first year.
But I'm afraid It Simply Won't _Do_ any more to use a language which
in its standard form goes out of its way to make software reuse hard.
So we're thinking about alternatives for next year.  My current
feeling is that a combination of (ANSI) C and (draft standard) Scheme
may be appropriate.

Criteria.
--------

1.  We must be able to get our hands on affordable implementations of
    the language or languages that are really *solid*.  Beginning
    students have enough trouble finding and coping with their own
    mistakes.  I'll take quiet reliability with minimal features over
    sexy-but-shoddy any day.  It's *immoral* to foist flaky systems
    onto beginners.

2.  The affordable reliable implementations we need are for
	PCs
	Macs
	Encore Multimax (NS32532, UNIX System V.3)

3.  *Reliable* support/debugging tools would be a big plus.  (GNU
    Emacs provides some very nice interfaces, but can you really
    see a couple of hundred students using it _at_once_ on a time-
    shared multiprocessor?)  There are some very nice things on
    Macs and PCs, but the Pascal debugger we currently have on the
    Encore, um, well, let's just say it wouldn't win any awards.

4.  There should already be experience with using the language as a
    first language that we can draw on.  Ideally there would be some
    good textbooks.  There might even be people will to tell us what
    works in such a course and what doesn't.

5.  Most RMIT CS students look for a job once they have their degree.
    That means that as well as teaching the fundamentals of computer
    science, we have to teach them skills which they _can_tell_ are
    going to be relevant to getting jobs.  So although there are a
    lot of really neat things we could use in 1st year we can't ONLY
    use something ideologically sound.

6.  But even the "practical" language should at the very least not
    get in the way of good software engineering practice.  At an
    absolute minimum, it should be _possible_ to put programs
    together out of lots of little pieces without departing from
    the "official" version of the language.  (Fortran is in, old
    ISO Pascal is out.)  Some kind of "official" support for
    assertion checking (best debugging tool I know) would be good.

7.  On the other hand, disc space is limited on our file servers &c    
    (isn't it always) so something that requires large per-user
    states (such as __poor__ implementations of Ada) is out.
    
8.  We're serious about databases here.  There should be data base
    products around offering embedded SQL for language X.

Comments
========
If there are *solid* Ada implementations that we can afford to get and
use, I'd argue for Ada.  The language has all the things which looked
good about Pascal, with few of the hidden "gotcha's".  (I very much
like the fact that integer overflow &c is by default _reported_.)

I know that the University of Bristol use Modula-2 plus a functional
language (I think Miranda).  However, the teachers I spoke to there
complained of the quality of the Modula-2 compiler available on their
UNIX system.  As an advance on Pascal, Modula-2 strikes me as "too
little, too late", and whatever its merits, it doesn't look as good
on a resume' as something the employer is actually using.  The point
does remain that people I trust tell me they are getting good results
from this mix.

Old ISO Pascal has its limits.  I understand that there is a new
standard, "Pascal Extended" or some such.  This may well answer most
of the objections to the language qua language.  But what about
*solid* implementations available *now*?

Eiffel?  (Pauses to wipe chin.)  (Does it again.)  We have Eiffel on
a non-teaching machine and are in the process of getting it for our
Encores.  I can hardly _wait_.  But PC?  Mac?  How does it work as
a first language?  Is Eiffel conquering the world at the rate it
deserves, so that students starting next year are going to find
employers wanting their skills in 3 or 4 years' time?  (Yes, I _know_
that our students will end up being able to learn other languages.
They're going to be exposed to several others here.  But their future
employers have their own points of view.)

As far as I can see, there isn't _anything_ students do in the 1st or
2nd years here that can't be done more easily in Scheme.  We have a copy
of T 3.1 already running (T has a Scheme environment).  It is _so_ nice
to be able to say to a student who is wondering how some algorithm works
"let's type that up in Scheme <tappity tap> now let's run it, let's trace
that, let's stop and pick up a copy of that data structure and poke around
in it, let's print out that other thing" all within the one language.
(Why don't more languages provide ways of producing human-readable
representations of data structures automatically?  And of reading them
back?)  Time after time something which takes a few lines of Scheme takes
5 or 8 times as many lines in Pascal (ignoring begins and ends) and
(we haven't got a particularly good Pascal compiler) doesn't run any faster.

I really hate to say this, because giving beginners this much rope does
_not_ commend itself to me, but ANSI C
	1 has some solid implementations (well, at least as solid as Pascal)
	2 on PCs, Macs, and I think gcc will run on Encores (I don't agree
	  with the FSF, but gcc is commercial quality or better)
	3 Some of the PC and Mac versions have flashy environments,
	  and gdb _has_ to be an improvement on the Encore Pascal debugger
	4 C has been around a while, there are lots of books, including
	  some nice data structures books (and the University just up the
	  road use C, and we're teaching it in a later year _anyway_)
	5 C is a definite plus on a resume'
	6 Building C programs out of pieces is not only possible, it's
	  the norm.  <assert.h> is pretty minimal, but it's _there_.
	  'make' or tools like it is available for PCs and so on, and even
	  if it weren't, Melbourne University have a super-smart make called
	  'cake' that we can pick up.  And we have 'mkmf' so making makefiles
	  isn't much of a chore either.
	7 C implementations don't require special "project" directories,
	  and write permission on the main library area isn't needed.
	8 This one pretty well forces the choice of C, but it isn't as
	  important as the others.

There are of course all the well known traps and pitfalls of C, but Pascal
has a few of its own which aren't quite so well known.  I have thought about
C++, but that is a very complex language and it keeps changing.  It meets
many of the criteria.  (Judging from comp.lang.c++, *solid* implementations
are rare because no-one quite knows what they should do...) However, switching
from ANSI C to C++ ought to be fairly painless.

Why do I think that it would be a good idea to teach Scheme as well?
Because it is simpler and more expressive than Pascal or C, and the
contrast should be illuminating.  For example, instead of thinking of
static types and static type declarations as Part Of The Way Things
Just Have To Be, students would immediately realise that they are a
_choice_ in a language; a few mistakes in Scheme will show _why_ static
types in C are useful, a little serious programming (trying to write a
generic table lookup function, say) will show why oversimplistic types
(as in C) are a pain.  The fact that most data structures can be written
out readably and read back is a big win.  The entire absence of malloc()
and free() in Scheme is a *huge* advantage.

Why Scheme rather than some other Lisp dialect or functional language?
Because it is a _small_ language for which good implementations are
available on PCs, Macs, and Encores.


Ok, so why am I posting this?
To pick your brains, of course.
If you have taught a first-year CS course successfully using one of
these languages, I'd like to hear about why you made that choice, why
it worked (or why it didn't), why you think my leaning towards ANSI C
and Scheme is inspired/utterly stupid.
Am i using the right criteria?  What _should_ I be looking for?

Please send E-mail to
	ok@goanna.cs.rmit.oz.au
with "first year" as the subject line.  I'll summarise.

-- 
"A 7th class of programs, correct in every way, is believed to exist by a
few computer scientists.  However, no example could be found to include here."