by RockyMcNuts · 15y ago · 0 comments
Things like pointer arithmetic, memory allocation, etc. distract from the basics and high-level concepts.
I would start with Python or Ruby these days. If Python is good enough for intros at places like MIT, it's good enough for me.
C is a masterpiece of elegance and simplicity and gives you a mental model of how a real computer works, and it gives you a foundation for understanding Unix, but I just think it overloads a beginner with stuff that gets in the way.
came to comments expecting a lot of reasons why Scheme or Lisp was a better choice LOL
Sure, it takes a while for you to wrap your head around pointers. But it also takes a while for you to wrap your head around inheritance. By virtue of being a smaller language, C has less of these things to wrap your head around.
If you need a dynamic array, you have to build it yourself from what you already know. Instead of having to learn yet another opaque concept, you're reinforcing your knowledge of pointers and dynamic memory allocation. Double benefit!
And once you know C, it can give you a boost towards learning other languages - most of them are implemented using C! If I don't understand something, I can always look at the source to see how it works. Since they're implemented in C, many languages tend to map easily to C concepts.
The same cannot be said about going the other way. A Ruby programmer learning C has to unlearn all the assumptions and niceties Ruby has spoiled them with. How much of Ruby is going to be applicable to C?
As long as you want to teach someone programming and not computer science I think a high level language is much better suited.
If you want to do 'computer science' or engineering, eventually you have to learn both.
But for a beginner, who might end up just casually coding as part of another discipline, or wants to understand computers as part of a liberal arts education and never goes past the first language, I think the higher level abstractions are a better place to start. (And the languages are a little gentler)
Only if he wants to learn C.
But why bother? For the overwhelming absolute majority of programmers it's a complete waste of time.
C is to computer science as latin is to medicine. All medical doctors need to know a little bit of latin
The school in question is mostly low-income kids looking for a vocational experience, so we expected a bunch of kids who would be out of their depth if thrown in without a garbage collector. But then the teacher mentioned that none of the kids had a hard time learning C or C++, pointers included.
So the group of game developers who had come to advice pretty much all agreed that learning C/C++ first was actually the best thing that could happen to those kids. Show them C first to teach them what the machine is REALLY doing (with only a minimal abstraction layer), give them OOP with C++, and THEN transition them to a scripting language and higher level environment so they can produce something interesting before the class is over.
It used to. Now, with multicore systems and out-of-order execution and cache and nearly everything else that makes modern hardware fast enough to use, it is an over-simplified view of the abstraction the hardware wants you to see, but is not detailed enough to guide you when you need extra performance.
As an example, C says nothing about cache lines; its memory model is completely flat. Cache is ideally 'transparent', but we all know that cache hits are a lot faster than misses. C gives you no guidance on how to arrange your data structures to ensure as many hits as possible.