Many of todayās most well-known programming languages are old enough to vote. PHP is 20. Python is 23. HTML is 21. Ruby and JavaScript are 19. C is a whopping 42 years old.
Nobody could have predicted this. Not even computer scientistĀ Brian Kernighan, co-author of the very first book on C, which is still being printed today. (The language itself was the work of Kernighan’sĀ co-author Dennis Ritchie, who passed away in 2011.)
āI dimly recall a conversation early on with the editors, telling them that weād sell something like 5,000 copies of the book,ā Kernighan told me in a recent interview. āWe managed to do better than that. I didnāt think students would still be using a version of it as a textbook in 2014.ā
Whatās especially remarkable about C’s persistence is that Google developed a new language,Ā Go, specifically to more efficiently solve the problems C solves now. Still, itās hard for Kernighan to imagine something likeĀ GoĀ outright killingĀ CĀ no matter how good it is.
āMost languages donāt dieāor at least once they get to a certain level of acceptance they donāt die,” he said. “C still solves certain problems better than anything else, so it sticks around.ā
Write What You Know
Why do some computer languages become more successful than others? Because developers choose to use them. Thatās logical enough, but it gets tricky when you want to figure out why developers choose to use the languages they do.
Ari Rabkin and Leo Meyerovich are researchers from, respectively, Princeton and the University of California at Berkeley who devoted two years to answering just that question. Their resulting paper,Ā Empirical Analysis of Programming Language Adoption, describes their analysis of more than 200,000 Sourceforge projects and polling of more than 13,000 programmers.
Their main finding? Most of the time programmers choose programming languages they know.
āThere are languages we use because weāve always used them,ā Rabkin told me. āFor example, astronomers historically use IDL [Interactive Data Language] for their computer programs, not because it has special features for stars or anything, but because it has tremendous inertia. They have good programs theyāve built with it that they want to keep.ā
In other words, itās partly thanks to name recognition that established languages retain monumental staying power. Of course, that doesnāt mean popular languages donāt change. Rabkin noted that the C we use today is nothing like the language Kernighan first wrote about, which probably wouldnāt be fully compatible with a modern C compiler.
āThereās an old, relevant joke in which an engineer is asked which language he thinks people will be using in 30 years and he says, āI donāt know, but itāll be called Fortranā,ā Rabkin said. āLong-lived languages are not the same as how they were when they were designed in the ’70s and ’80s. People have mostly added things instead of removed because that doesnāt break backwards compatibility, but many features have been fixed.ā
This backwards compatibility means that not only can programmers continue to use languages as they update programs, they also donāt need to go back and rewrite the oldest sections. That older ālegacy codeā keeps languages around forever, but at a cost. As long as itās there, peopleās beliefs about a language will stick around, too.
PHP: A Case Study Of A Long-Lived Language
Legacy code refers to programsāor portions of programsāwritten in outdatedĀ source code. Think, for instance, of key programming functions for a business or engineering project that are written in a language that no one supports. They still carry out their original purpose and are too difficult or expensive to rewrite in modern code, so they stick around, forcing programmers to turn handsprings to ensure they keep working even as other code changes around them.
Any language that’s been around more than a few years has a legacy-code problem of some sort, andĀ PHPĀ is no exception.Ā PHPĀ is an interesting example because its legacy code is distinctly different from its modern code, in what proponents sayāand critics admitāis a huge improvement.
Andi Gutmans is a co-inventor of the Zend Engine, the compiler that became standard by the time PHP4 came around. Gutmans said he and his partner originally wanted to improve PHP3, and were so successful that the original PHP inventor, Rasmus Lerdorf, joined their project. The result was a compiler for PHP4 and its successor,Ā PHP5.
As a consequence, the PHP of today is quite different from its progenitor, the original PHP. Yet in Gutmans’ view, the base of legacy code written in older PHP versions keeps alive old prejudices against the languageāsuch as the notion that PHP is riddled with security holes, or that it can’t “scale” to handle large computing tasks.
“People who criticize PHP are usually criticizing where it was in 1998,ā he says. āThese people are not up-to-date with where it is today. PHP today is a very mature ecosystem.ā
Today, Gutmans says, the most important thing for him as a steward is to encouraging people to keep updating to the latest versions. āPHP is a big enough community now that you have big legacy code bases,” he says. “But generally speaking, most of our communities are on PHP5.3 at minimum.ā
The issue is that users never fully upgrade to the latest version of any language. Itās why many Python users are still using Python 2, released in 2000, instead of Python 3, released in 2008. Even after six years major users like Google still arenāt upgrading. There are a variety of reasons for this, but it made many developers wary about taking the plunge.
āNothing ever dies,” Rabkin says. “Any language with legacy code will last forever. Rewrites are expensive and if itās not broke donāt fix it.ā
Developer Brains As Scarce Resources
Of course, developers arenāt choosing these languages merely to maintain pesky legacy code. Rabkin and Meyerovich found that when it comes to language preference, age is just a number. As Rabkin told me:
A thing that really shocked us and that I think is important is that we grouped people by age and asked them how many languages they know. Our intuition was that it would gradually rise over time; it doesnāt. Twenty-five-year-olds and 45-year-olds all know about the same number of languages. This was constant through several rewordings of the question. Your chance of knowing a given language does not vary with your age.
In other words, itās not just old developers who cling to the classics; young programmers are also discovering and adopting old languages for the first time. That could be because the languages have interesting libraries and features, or because the communities these developers are a part of have adopted the language as a group.
āThereās a fixed amount ofĀ programmerĀ attention in the world,ā said Rabkin. āIf a language delivers enough distinctive value, people will learn it and use it. If the people you exchange code and knowledge with you share a language, youāll want to learn it. So for example, as long as those libraries areĀ PythonĀ libraries and community expertise is Python experience, Python will do well.ā
Communities are a huge factor in how languages do, the researchers discovered. While there’s not much difference between high level languages like Python and Ruby, for example, programmers are prone to develop strong feelings about the superiority of one over the other.
āRailsĀ didnāt have to be written inĀ Ruby, but since it was, it proves there were social factors at work,ā Rabkin says. āFor example, the thing that resurrectedĀ Objective-CĀ is that theĀ AppleĀ engineering team said, āLetās use this.ā They didnāt have to pick it.ā
Through social influence and legacy code, our oldest and most popular computer languages have powerful inertia. How could Go surpass C? If the right people and companies say it ought to.
āIt comes down to who is better at evangelizing a language,ā says Rabkin.