Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Best First Programming Language Thread

11 views
Skip to first unread message

Randall Hyde

unread,
Nov 12, 2001, 4:12:23 PM11/12/01
to

"Juzzer" <j...@globalnet.co.uk> wrote in message news:tv0cs6...@corp.supernews.com...
> Beth, interesting as ever, however your dissection confused the original
> context somewhat.
>
> It was suggested that C was more conducive to good programming. If one
> looks at requests from 'newbies' as to language choice, C++ is the most
> voluble reply, and it is viewed as distinct and superior to C. I merely
> wondered whether its limited OOP features represented an improvement and
> were a factor in its success, rather than just being the language favoured
> by Microsoft.

Having taught C++ as the first language to University students, I'm not 100%
sure I agree with this. C++ suffers a bit because it doesn't support a language
design feature known as "restrictability." Restrictability means that you can
learn and use a restricted subset of the language and write reasonable
programs.

Now, in theory, one could argue that you could restrict yourself to the
subset of C++ that is C and, therefore, C++ has to be better than C
since it supports some other, easily taught, features (e.g., pass by reference
parameters). In practice, nearly every introductory text I've seen insists
on teaching stream I/O (i.e., cin and cout) because it is "easier" to learn
and use than the C standard library's "formatted I/O functions" (e.g.,
printf and scanf). In practice, however, if you don't know about objects
and overloading, you start to get into trouble when using the cin and cout
stream objects. You might think that this wouldn't be a problem; but my
experience with hundreds (or even thousands) of students suggests otherwise.

I've never really learned Java well. But I would guess that it would make
a better introductory language than C++. That's only a guess, though.
IMHO, Pascal is still the best teaching HLL around.

> That said, books do encourage the adoption of a different mindset for OO
> and I regularly see posts requesting assistance, where the simplicity of a
> routine is lost in class declarations. This is not a criticism of beginners,
> they may know what they want to do but a supposedly superior language is
> impeding them or else they've been too heavy with the cut+paste and have
> little practice in building code from the ground-up.

Amen. C++, and especially operator overloading in C++, often becomes
a solution in search of a problem for many programmers.

> Think how very, very easy a linked list is in asm, then see on another
> ng right now a faltering attempt with classes is eventually met with 'give
> up and use STL'.

Of course, the whole idea of a good generic class is that "it's already
written, you just use it." Writing those generic classes is no easy chore.
That's true in assembly as well as HLLs. Furthermore, the same sort
of linked list that's easy to do in assembly is easy to do in C as well
(okay, not quite as easy because of minimal type checking, but still
pretty easy). The problem is when people start applying the gold
plating (i.e., suffer from feature-itis) and decide to make their linked
list routines do everything under the sun. Clearly they're trading
complexity and efficiency away for a general algorithm.

OTOH, if there's a drawn-out thread in some other newsgroup
worrying about writing a linked list class, and the people are having
problems coming up with one, the advice to use the STL is very
good indeed :-)

Note, btw, that there is a linked list class in the HLA Standard Library :-)
Randy Hyde

Ramiro

unread,
Dec 12, 2001, 3:44:36 PM12/12/01
to
"Randall Hyde" <rh...@transdimension.com> wrote in message news:<XWWH7.11620$691.75...@newssvr13.news.prodigy.com>...

> "Juzzer" <j...@globalnet.co.uk> wrote in message news:tv0cs6...@corp.supernews.com...

> Having taught C++ as the first language to University students, I'm not 100%

Randy,
I also teach C/C++ but at a community college. C/C++ has too many
gotcha's for a beginning programming student.
IMHO, it would not be too hard to make it a suitable introductory
language without going back to Pascal. There should probably be a
variant called SafeC or RestrictedC which would disallow most of the
constructions which are problematic for a beginning programmer. A real
boolean type, no empty statements, fail-safe io , required prototypes
declarations.

ramiro

Randall Hyde

unread,
Dec 20, 2001, 6:39:25 PM12/20/01
to

Ramiro wrote in message ...

>"Randall Hyde" <rh...@transdimension.com> wrote in message
news:<XWWH7.11620$691.75...@newssvr13.news.prodigy.com>...
>> "Juzzer" <j...@globalnet.co.uk> wrote in message
news:tv0cs6...@corp.supernews.com...
>
>
>Randy,
> I also teach C/C++ but at a community college. C/C++ has too many
>gotcha's for a beginning programming student.
> IMHO, it would not be too hard to make it a suitable introductory
>language without going back to Pascal. There should probably be a
>variant called SafeC or RestrictedC which would disallow most of the
>constructions which are problematic for a beginning programmer. A real
>boolean type, no empty statements, fail-safe io , required prototypes
>declarations.
>
>ramiro

Well, Java does cover most of that (you can still have empty statements).
The problem I'd see with a "restricted C" is that it would have to be
a subset of C/C++ in order for it to be viable. Students don't like
the idea of having to learn a new language once they progress beyond
the capabilities of their first language; they don't mind learning new
stuff, they do mind having to relearn stuff. This is why Pascal ultimately
failed -- it wasn't powerful enough to do real-world stuff so the students
had to switch to C/C++ after the introductory courses (yeah, I know
there are extended Pascals and Delphi, but they have their own
problems, like portability).

A better solution would be to design a new language that provides
everything that Pascal, C/C++, Java, Ada, etc., provides but
with a simplified syntax. The language has to support restrictability
so beginners can write meaningful programs by learning only
a few statements in the language, but the language also has to be
powerful, allowing the programmer to use more features in the
language as they grow. IMO, you have to learn too much up front
in order to practically use C++, Java, or Ada. C's I/O is too
miserable, and Pascal is too weak. There are some other
interesting languages I've looked at, but none of them are
great teaching languages. Some people push LISP as the
first programming language, but IMO this messes newcomers
up more than C/C++ (people are strongly influenced by the
first language they learn, and I'm not convinced that learning
a functional language first is best).
Oh well, maybe Knuth will actually write "Utopia" or I will
someday finish HLA and can get to work on Panacea :-)
Randy Hyde

0 new messages