Quoth Nadav Har'El on Fri, Jun 06, 2003:
> On Fri, Jun 06, 2003, Vadim Vygonets wrote about "Re: FS/OS in schools: why don't
> *they* tell us what they want?":
> > You should teach *something*. Why is C taught in schools? Is it
> > the best programming language?
(BTW, what I meant was "programming language", not "teaching
language".)
> Actually, yes, it's the best programming language to teach the basic
> concepts of programming and computer-science. (in my opinion).
Pascal?
> To understand what I mean by that, consider:
>
> 1. Unlike higher-level languages, what-you-write-is-what-gets-done; No
> automatic garbage collection, no memory allocation behind your back,
> no "magic". This is important for new learners that don't understand
> that background magic, and need to be taught first about what actually
> happens and about the basic concept that the computer does what you
> tell it.
Too much of "no magic" isn't good either. It's great that C
teaches you pointers, but it's not so great that you need to use
pointers for call-by-reference (is it the correct terminology?).
Memory allocation in C is too low-level, which results in more
memory leaks in C programs than in comparably complex programs in
other languages. Strings in C are not a first-class type, which
means that you need to work with them almost manually, peeking
the characters from within the string.
> 2. It is simpler than other languages. I feel that I can safely say that
> I know C - all of it (or at least a great majority of it).
Yes, C is quite small (I'd say, comparable to the aforementioned
Pascal), but then you do on an say:
> It's much
> harder for me to say the same about C++ or Perl.
comparing C to the two most bloated of the popular languages.
C++ is just a bloated language based on C (I still can't see any
reason to base an object oriented language on C), Perl is a
syntactic disaster (though I admit that I use it quite often).
> If you think it's impossible or bad to learn C as your first language, you
> are wrong. When I was a kid, I tried to learn Basic and basically failed.
BASIC is not the best programming language in the known Universe
either.
> Perhaps nowadays kids should be "enticed" to the world of computers by
> first being shown "cool" languages in which you can program graphics, and
> so on (Logo was supposed to be a language like that!), but once the kid
> is ready to learn the "really important things" like algorithms and data-
> structures, I believe C is a better learning language.
Pascal. I would never dream of writing a real program in Pascal,
but it's a good functional programming language for students, one
of the reason being that the student can concentrate on learning
concepts instead of fighting with pointers and memory allocation
when it's not needed.
> > Is it widely used? Well, yes, it is, but will it be widely used in five
> > years?
>
> Yes it will. Want to bet? :)
No. As I wrote in my response to Amos, it will stay because it's
taught everywhere. Also, UNIX with its language xenophoby (one
word: libc) makes sure C stays as long as UNIX stays (yes,
Bourne^H^H^H^H^H^HPOSIX shell will stay too).
> Anyway, if you consider C++ an extension of C, studying C first is time
> well spent. Of course, if the teacher will emphasise later when teaching
> C++ that many habits must not be carried from C to C++, but the commonolities
> are bigger than some C++ people are willing to admit.
I'm not an expert in programming languages (for starters, I don't
really know any LISP), but I can compare C to Forth.
- Forth has about zero syntax: there are words separated by
whitespace; if the word is known (has been defined), it's
parsed as that word, otherwise, an attempt is made to parse it
as a number, and if that fails, it's an error. There's no
difference between + (addition), allocate (memory allocation),
if (conditional execution) and \ (start comment). And no
grouping (parentheses "()" in C).
- Forth words (functions) accept zero or more arguments (like C
functions), and return zero or more values (unlike C functions,
that can't return more than one value; this feature in C can't
be changed without changing the syntax completely).
These examples don't show the essence of Forth (which is quite
interesting), but they show a couple of things in C that we
consider for granted in programming languages, apparently without
a good reason.
Vadik.
--
XVII:
Software is like entropy. It is difficult to grasp, weighs nothing,
and obeys the Second Law of Thermodynamics, i.e., it always increases.
-- Norman Augustine
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]