Save over 40% when you secure your tickets today to TNW Conference 💥 Prices will increase on November 22 →

This article was published on June 27, 2021

How a 70s schoolteacher invented C, one of the most influential coding languages

A tale of incredibly slow computers, three Davids, and the long-standing legacy of C


How a 70s schoolteacher invented C, one of the most influential coding languages

If you thought that C is the kind of language that only 60-year-old white men know, think again. Yeah, it’s the dinosaur among today’s programming languages. But it’s still alive and kicking in more areas than you’d think.

For one, Unix is written in C. Originally written in assembly, the Unix kernel was rewritten in C back in 1973. This made Unix a lot more portable across different machines, and helped make it popular. And without this, we wouldn’t have all the beautiful operating systems of today — think Linux, Mac OS X, Android, iOS, Chrome OS, and whatever your router is running with.

If you’ve ever worked with databases, you’ve definitely used C, too. Even if you weren’t aware about that! Database management systems like Oracle Database, MySQL, and others are written in C. Most of them have since been rewritten in C++, but that’s also a direct descendant of C.

And even if all you do is Python, you’ve probably been using C all the time. Unless you’re opting for Jython, IronPython or PyPy, you’re using CPython. That’s the original implementation of Python: you’re writing Python code, but the interpreter — the thing that translates your human-made code into something the machine understands — is actually written C.

In short, C is everywhere. It’s not just a big fat dinosaur that somehow managed to survive in the modern age. It’s incredibly successful because it’s extremely useful.

That’s why it may come as a surprise that C didn’t originate from success. It came from a decade-long string of failures, and might not be around without a school teacher who liked to code during holidays.

The school teacher who was buddies with Alan Turing

Meet Christopher Stratchey. Born 1916 into an influential British family, he studied at Cambridge University and got to know many a famous scientist there. However, he seemed to have a years-long tendency to neglect his studies, and his performance in the final exams was rather underwhelming.

That might be the reason why he didn’t pursue an academic career like many of his peers. Instead, he spent the war years in industrial radar research. He then became a schoolteacher and remained one until 1951.

That’s when everything changed for him. A friend introduced him to the facilities of Britain’s National Physical Laboratory. Stratchey ended up spending his school holidays and downtime with the lab’s Pilot ACE, the first computer with Alan Turing’s Automatic Computing Engine.

Stratchey aimed at teaching the computer how to play checkers. Tackling such a logical task was remarkable at a time where computers were primarily used to quickly solve equations.

He didn’t succeed in his first attempt because the Pilot ACE didn’t have the storage capacity to do the job. You might be laughing at just how small that memory must have been — that’s legit — but remember that these were the 1950s!

Stratchey managed to wind up a better machine, though, the Ferranti Mark I, through his old buddy Alan Turing. With his friend’s guidance, he finally succeeded.

The word quickly spread about this unusual accomplishment, and soon Stratchey got called to promote the developments in computer science for the British government.

Man sitting in front of computer showing a brain with label “unapproved”
Cambridge university was skeptical about a new language, but the three Davids won. Image by author

Three Davids want a language

Meanwhile in Cambridge, the university wanted to buy a new computer. That was a big deal at the time, and because the computer was brand new, they pondered about inventing a new language for it.

It was clear that a new computer needed a new operating system, but not necessarily a new language. Nevertheless, three researchers, David Hartley, David Wheeler and David Barron, wanted to have fun creating a new language.

In addition, the three Davids didn’t ask the future users about the pros and cons of old languages. Fortran IV, for example, was already being used at the time and would have been fit for the job.

The three Davids thought that they could easily create something better, though.

They dubbed it CPL, short for Cambridge Programming Language. That became Combined Programming Language after a couple of researchers from the university of London joined the three Davids.

In hindsight, notes David Hartley, trying to make this new language was “a damn stupid thing to do.”

The language got too complicated

Perhaps it was also “damn stupid” to bring Christopher Stratchey to oversee the project. His computational abilities couldn’t be doubted, but he seemed so in love with the project that he was unable to set priorities. The development team therefore got hooked up on minor issues instead of treating the big ones effectively.

Soon enough, CPL was known as Christopher’s Programming Language.

Because of all the minor details that the team implemented on Stratchey’s insistance, the language became far too complicated. When they wanted to write a compiler, it largely failed because the resulting machine code was inefficient.

Doctor holding stethoscope again computer screen showing some code
Richards removed everything that wasn’t important from CPL. Image by author

The language got too simple

When Stratchey left for a few months’ stay at MIT, Martin Richards joined the CPL team and set out to simplify it. The goal was, of course, to get something that produces a good compiler and efficient machine code.

That’s how Richards made BCPL out of CPL — Basic CPL. In a way, that was a new language — but also an admission that the old CPL had failed miserably.

When he joined Stratchey at MIT a little later, a colleague from Bell Labs came over to see what the two of them were doing. The colleague, Ken Thompson, had been working on Multics, another operating system that was about to be abandoned. (It eventually survived, but that’s a different story.)

Thompson eventually pivoted to developing Unix, one of the most-used operating systems to this day. He managed to install Unix on a small computer, a PDP-7, but BCPL was still too voluminous to fit on that same machine. He cut it down to the features that he thought were most important, and dubbed the new language B.

C is born — finally

In 1971, Dennis Ritchie had adopted B and was adding features to make it useful for more powerful computers. This language he called NB — New B.

Thompson, meanwhile, was working on rewriting Unix in a high-level language. At the time, most operating systems were still written in assembler, but because of this one had to develop a new operating system whenever one bought a new machine. A high-level Unix, in contrast, would work on any machine.

Thompson tried to use NB for this task but failed. Ritchie and he then added one feature after the other into NB until he was able to write Unix. Notably, they added structures, which weren’t to be found in any other languages at the time.

Structures were a change notable enough for the two to call it a new language. Voilà, in 1973, C was born!

Woman sitting in front of computer screen showing “<code/is/beautiful>”
C soon became popular, and is still a mainstay. Image by author

The slow spread of a wildfire

The numerous creators of C — sure of themselves though they were — didn’t anticipate how the language conquered so many spaces.

One success factor might have been that the PDP-11 minicomputer was extremely popular. It was dirt cheap to install Unix on it, and C came with Unix.

Since most computers were run at universities at that time, lots of students left university being familiar with C. That helped it spread across many industries, and through every corridor of academia of course.

Finally, the book The C Programming Language by Brian Kernighan and Dennis Ritchie was slim and concise, especially for a work about a programming language. This further leveled the playing field for beginners.

Despite its age, C might be fitter than your grandpa

Somehow, in its wonderfully not-straightforward ways, C succeeded eventually. But it’s the result of CPL which was too complicated, BCPL which was too simple, the even simpler B, and the slightly more complex but still to simple NB. And without Thompson’s task of rewriting Unix, it might have never happened.

It was Christopher Stratchey, the former schoolteacher, who overcomplicated many things and thus started the string of failures. But without those, C might not even have been invented.

Features of C are everywhere. Big concepts like structures, but also little things like the ++ and -- increment and decrement operators can be found in many languages today. They wouldn’t be there without C. Its offspring — C++, C#, and so on — wouldn’t be around either.

And that’s just the legacy of C. It’s also an extremely fast and safe language, which makes it the tool of choice in complex areas like robotics, computer vision, IoT, and more. That doesn’t mean that languages like Python don’t get used there, too, especially for first sketches. But the last step — the fine polish, if you want — is often written in C or C++.

So yeah, C is a dinosaur if measured by its age. But I bet it’s nimbler and more agile than your grandpa! Or your grandchild, for that matter…

This article was written by Ari Joury and was originally published on Data Driven Investor. You can read it here

Get the TNW newsletter

Get the most important tech news in your inbox each week.

Also tagged with