The other day, Marie pointed me to an interesting article where Jolie O’Dell decides to go back to school to get a computer science degree. She asked me what my thoughts were on some comments concerning the necessity of learning C/C++. I’ll paraphrase in order to avoid singling anyone out.
“Scripting languages create holes in proper programming. All a language, like PHP, will do is make you a PHP programmer, while a language like C or C++ will give you a fundamental understanding that can be applied to all languages and make you a better programmer no matter what the language. This is because these languages expose you to the way the computer really works (instead of abstraction): for instance, how a string is really created, or an array, or dynamic memory allocation. If you learn PHP, you will never bother to learn the low-level reality.”
The above is a munge of many commenters’ discussions.
What do you think of the above statement?
Here was my reply:
I don’t have a definitive answer to the claim since C was the third computer language I ever learned and C++ was the fifth. The first two were BASIC and Pascal. Back then, there were no interpreted (scripting) languages. So I never learned things “out of order” and don’t know how hard it is to learn them “backward.”
However, I feel the need to give some facts I do know.
First, this above is just another example of a common supposition of superiority that permeates the programming world as parodied by a friend:
Second, if it is true learning a high level language precludes learning a lower level one, then I could have never learned the language I learned between C and C++. It is easy to forget there is a language lower-level than C: assembly language programming, which is the language of the machine itself. Moreover, by the time I went to school, nearly every programmer my age who learned assembly, including a classmate who now makes a living coding in assembly language exclusively, learned it as a second language. According to that claim, they should not exist—or at least be very rare.
Third, C/C++ is not a single programming language but two that share nothing in common but syntax and the requirement to have a working knowledge of the former to use the latter. C a very low level language with a very simple syntax; C++ is not just an object-oriented version of the C, but can be—and often does—get complicated. Even at its simplest, the language is “overloaded” with features. Don’t believe me? The C book is 274 pages and hasn’t changed since around the time I learned it more than two decades ago, and the C++ book weighs in at 1050 pages and only glosses over some the libraries and frameworks you need under daily programming—themselves the subjects of books even larger in length. When talking about learning programming, it is hard to use C and C++ in the same breath and be referring to the same thing—we should talk about one or the other. When discussing them together, it becomes a moving target.
(Fourth, C and C++ have disappeared as primary “first languages for teaching programming to computer scientists” since about the mid 90’s. It has since been replaced with Java. Java is about as high-level as Python. So according to this theory, anyone who has matriculated in the last 15 years is pretty much fucked in the real world.)
My experience has been people know a low-level language like C (or C++ which means they learned C) find it very easy to pick up a higher level language like PHP. The reverse is less common, though not non-existent.
My suspicion is that it is not “easier” to go one particular direction, but rather that it is uncommon for a motivated student to go through a rigorous computer science program and not pick up C and C++ along the way—the same cannot be said of PHP (or Python). In other words, the fact that we see in industry a lot of C/C++ programmers tend to be better programmers overall and quicker learners is because they are more likely to have had a better programming education, not because the first language they picked up was C or C++. In fact, as I mentioned already Java is a more common language taught so there is a strong implication that they picked up C/C++ not as a first language, but as their second and third language! So C/C++ knowledge becomes a signal that the person had many years of formal education and the wherewithal to learn a second (and third) language. Know PHP programming? It probably means you wanted to install a counter on your Geocities homepage…or something.
(Wonder why so many Java programmers often seem incompetent compared to others with formal computer science education? My guess is that programmers who know Java aren’t incompetent per se, it’s just that a number thought they could get away with knowing only the language that they were taught in class. Programming Java often just serves up a signal as possibly someone who had no natural curiosity for programming and learned the minimum necessary to get their college diploma.)
Moreover, it is important to note that knowing any programming language makes it much easier to learn another one, so either course (C/C++ to PHP/Python or PHP/Python to C/C++) is an easier path than learning a first programming language (whether it be C, or C++, or PHP, or Python).
As for Jolie O’Dell, the problem is obvious. I’ll bet she tried learning Python out of the poorly named Learning Python book. Besides having errors in the first chapters, like many introductory textbooks on scripting languages, the book pre-supposes you already know how to program! I know it sounds crazy, but most textbooks on learning a programming language assume you already know at least one other programming language. This is evident in how quickly the gloss over difficult to explain concepts like “typing”, “objects” or “inheritance”, and how how much time they front-load a book with such minutia like what language that was used to build the “virtual machine” or tables of information on useless operator precedence rules.
Schools know this, so the professors there rework the material to be learned as a first language instead of a second. Plus, the structure of assignments and the carrot/stick of actually having grades cannot hurt.
Let me bring up an anecdote from physics. When I was studying physics, people complained how my generation was “all computers and software” and we didn’t know how to repair a TV or build an oscilloscope from scratch. While it was true I couldn’t rely on instantly understanding a circuit diagram in lab like my predecessors, I could make Mathematica dance and almost all modern experiments (and theory) required making a computer tango with numbers well beyond the ability of the previous generation.
We build on the achievements of others.
I bet programmers from the 70’s looked at the ones learning C/C++ and proclaimed them weak sauce because they were not coding in machine language. Similarly C/C++ people look at scripters and say the same.
Given that, it makes me worry that maybe this discussion is about measuring penis size instead of getting where you want to go.