I like the C programming language. In fact, I bought “The C Programming Language (2nd edition)” book in 1992 when I was still in secondary school and it was an amazing discovery for me. I wrote quite a bit of C at that time and migrated to C++ around 1994. Around 1996, I moved to Java and I have not really programmed in C or C++ since. I often wonder why, as I know that C is used quite a lot in systems programming (e.g. the Linux kernel) and C++ for UIs and games, etc.
I have just stumbled upon this quote from Fran Allen in Coders at Work by Peter Siebel:
Seibel: When do you think was the last time that you programmed?
Allen: Oh, it was quite a while ago. I kind of stopped when C came out. That was a big blow. We were making so much good progress on optimizations and transformations. We were getting rid of just one nice problem after another. When C came out, at one of the SIGPLAN compiler conferences, there was a debate between Steve Johnson from Bell Labs, who was supporting C, and one of our people, Bill Harrison, who was working on a project that I had at that time supporting automatic optimization.
The nubbin of the debate was Steve’s defense of not having to build optimizers anymore because the programmer would take care of it. That it was really a programmer’s issue. The motivation for the design of C was three problems they could not solve in the high-level languages: One of them was interrupt handling. Another was scheduling resources, taking over the machine and scheduling a process that was in the queue. And a third one was allocating memory. And you couldn’t do that from a high-level language. So that was the excuse for C.
Seibel: Do you think C is a reasonable language if they had restricted its use to operating-system kernels?
Allen: Oh, yeah. That would have been fine. And, in fact, you need to have something like that, something where experts can really fine-tune without big bottlenecks because those are key problems to solve.
By 1960, we had a long list of amazing languages: Lisp, APL, Fortran, COBOL, Algol 60. These are higher-level than C. We have seriously regressed, since C developed. C has destroyed our ability to advance the state of the art in automatic optimization, automatic parallelization, automatic mapping of a high-level language to the machine. This is one of the reasons compilers are… basically not taught much anymore in the colleges and universities.
I don’t know why but this is very troubling.
You see, since I started programming, I was always a fan of programming languages. I made it a must to try different types of programming paradigms and different languages. So far, I can say that I can somewhat write decent code in programming languages such as Awk, Bash, C, C++, Erlang, Haskell, Java, Javascript, Lisp, Nim, Pascal, PHP, Prolog, Python, R, Ruby, Scheme (Racket), Smalltalk (Pharo) and Typescript.
When I was a lecturer at the University of Mauritius, there was this big debate about whether to use a subset of C++ or Python to introduce programming to 1st year students. Students who had been through C++ didn’t perform well and the Python people were convinced that Python would work better (I was a bit reluctantly one of the Python people). For me, the programming language does not really matter. What matters more is the level of abstraction. I am convinced that 1st year students need to learn programming at a very high level in order to solve problems efficiently and concisely. This can be done using Python (and sticking to the higher-level constructs) or C++ (and using STL) or Scheme (using vectors to simplify things), etc. Then, in subsequent years, they can learn about the inner working of the machine (by using lower-level constructs whatever the language) and implementing their own data structures (and measuring their performance).
What Fran Allen is saying is that C (and languages derived from C such as C++, Java and C#) have forced us, programmers, to operate at a lower-level than needed (or desirable). Students have had to suffer for a quarter of a century (I would tend to think that this is true) and professional programmers have also had to suffer (maybe less but enough — and we seem to enjoy this suffering).
What if C had remained a programming language to just do systems programming? Would we use descendants of COBOL, Pascal or LISP today in our daily life? With all kinds of optimizations and transformations being done automatically? Who knows?
Was the C Programming Language one of the best and, at the same time, one of the worst things to happen? Maybe.
Leave a Reply