lesto wrote:you never play with register or stack allocation (at beginning),
I know, it's a travesty! After all, how can you understand functions if you haven't written the code that builds your own stack frame?
(Sorry, this will be your one piece of sarcasm for this post.)
you'll always play with pointer. This is very important to understand the difference between passing variable by value or by reference (live VB)
So first, why is
that important early on? How does that help you learn how to
think computationally? (In other words, know how to decompose your problem until you have something precise enough that you can actually write code for.)
Second, what the heck makes you think you can't teach that in a language other than C? You don't need the ability to synthesize pointer values out of thin air in order to talk about what a pointer is. Sure, you'll call it a reference or something like that, but any decent course in Java will talk about how references store memory addresses and stuff like that.
Programming in C will normally not confront you with any idioms that are associated with object-oriented, functional, list or generic programming. The consequence is that when you move from C to a richer language like C++, Haskell, Java or Python, you'll have to learn a lot again
true, you are going to learn MORE, but you will still use what you have learned from sequential languages. This mean nicer learning curve.
You also have to
unlearn some stuff... but this is beside the point.
The problem with C is that (1) it makes you care about details that are irrelevant to the problem at hand (like when to free pointers) and (2) won't tell you when you make a mistake (like an out-of-bounds access). Dealing with those problems is a distraction from
learning to think computationally, and should wait.
You don't go to swimming lessons and the first day they throw you into a rip current. Yes, you should learn how to get out of a rip current at some point, but that comes after spending some time in the 3" section of the pool, then deeper waters, then the ocean. Teaching a class in C is basically tossing your students into the rip current, then paddling alongside trying to tell them how to move their arms and legs to get back to shore.
Edit: This isn't to say that individual people can't start with C... but it takes a certain mindset that I don't think benefits even most CS people. And for that reason I don't think it should be a typical early CS curriculum class. (And if you
do teach such a class, it really ought to be a much more integrated class than your typical programming one: I really do think you need to look at what the compiler is doing and to a small extent what the hardware is doing under the hood, or you're keeping all of the bad things about C and ignoring why you would want to use it.) Even if you
have more than a passing interest in CS, I suspect it will be more beneficial to start in a language like Scheme or Python or ML than in C. And that's ignoring the practical issues of teaching students who are not fully interested in programming, and not turning
off students who are.