We could probably debate forever which programming language is best to learn first — it could depend on your goals and other considerations. Mac developer Evan Miller, however, makes a strong case for learning C first, likening it to learning to drive a manual car rather than an automatic.
Photo by dullhunk
As Miller puts it:
Python is convenient, and in many ways, a great advance over the C programming language. However, just as teaching teenagers to drive automatic transmission is a practical guarantee that they will never learn stick, advising neophytes to learn Python is creating programmers who will never bother to learn how to code in C. And that, I believe, is a bad thing.
He writes that knowing C is definitely not a requirement for a productive career in software, but that learning a language like Python isn’t challenging enough for the kinds of people who might become the best programmers — those who would dig deeper and figure out how computers work:
C forces you to build a mental model of what the computer is actually doing when you run your programs, much like a teenager figuring out how the gear mechanism works by playing around with the clutch. As you ask why and keep digging for answers, your mental model will grow to encompass the process model, the CPU architecture, the memory hierarchy, the operating system, and so forth. It’s that mental model — rather than the C language itself — that will enable you to poke through the abstractions created by others, and write programs you never thought possible.
Just some food for thought. (Harvard’s CS50, by the way, starts with C, and it is a head-banging yet great experience.)
You Can’t Dig Upwards [Evan Miller]
Comments
7 responses to “The Case For Learning C As Your First Programming Language”
I learned C++ first, then Java. Then I didn’t do any coding for years. That was for a lot of reasons — getting burned out on uni, low self-discipline at the time — but trying to learn the intricacies of managing pointers certainly didn’t help. I can accept the premise here, but I think the value of starting with a higher language with less overhead and more readability probably outweighs it.
I think C is a very important language to learn as it teaches you a LOT about memory management (the difference between the stack and the heap for example), but as a first language, no. I think learning HOW to program without that extra overhead is a better way to get into it all. As a second language, you bet. Personally through uni I went Java->C->C++->Rest of my career with various languages.
The author has no clue about how children learn.
The metaphor about a manual car is rubbish because it completely misses that learning to code is a deep mental task, requiring abstract mental tools.
My first language was BASIC, aged 9 (in ’78 that was fairly young to learn coding).
There is absolutely no way I had the abstract mental tools to learn C as my 1st language at 9.
Heck, some stuff in C was brain-straining aged 19!
Teach your children to code young, using a rewarding language.
Unless of course you want to steer them away from coding forever, in which case try to teach them C young.
Actually yes, I must admit, I started on BASIC too, aged 10 (back in 1990).
Start with C, and then continue to produce buffer overflows for the rest of your life.
imho focusing too much on the language misses the point of programming, i.e. building software. And on a higher order, building systems.
It doesn’t matter if you know how to turn on the led of a disk drive if you don’t know what to do with it.
For formal learning, yes.
For informal tinkering, especially if it’s as a kid, I’m not so sure that it’s as good an approach.
I had had some exposure to other languages (BASIC, Perl, PHP, some game scripting) before I formally learned programming, but my formal programming education began with C and then branched out from that into Assembly, LISP, C++, Java and others. For a university course or similar, I think C is absolutely the best starting point because of exactly what the article author says: it forces you to understand what the computer is doing when you run those instructions. IMO you can’t be a really good programmer without that understanding. Additionally I’m not sure if you can truly grasp the benefits and pitfalls of things like OO programming if you don’t have that fundamental understanding of how the things you write are actually implemented underneath.
But if you were wanting to teach a kid to program, that’s not really important. What’s important is being able to help them to get results quickly and iterate on their work fast. High level languages are better for that. Understanding the inner workings and implications of what they’re doing can come later.
I think that a real programmer has to understand difference between usage of x > 0 instead of x >= 1. To do that you have to start from assembler. I would call all OO guys as software developers, not programmers.
Um I think Binary was the first programming language. Actually + voltage and -voltage, since the first computers were programmed via wires.