Better Programming Languages¶
Why are so many successful websites in PHP? I can list plenty of reasons why it is a crap language, starting with the lack of a type system. However there are many successful websites that are implemented in it. Is it just luck? The guys behind Facebook, Wikipedia, Slack were not kids who didn’t know better. I think we should start being more empirical when discussing technology choices.
This could be because the choice of implementation language is basically irrelevant, and building the right product is what affects the outcome. Are they actually correlated? Are the behaviours that lead to picking php as the implementation language also a cause of success, or is there an actual causal link here?
Nearly all of Linux is written in C. Basically every computer game in the last 10 years has been written in C++.
It is very easy to find articles that explain why Lisp/Smalltalk/Haskell/... are far better languages than PHP, C or C++, but they almost invariably answer the question “Why doesn’t anyone use this?” with “Because the world is stupid”.
A definition of ‘better’ that delegates to the opinion of people who ‘do languages’ is basically just fashion and about as relevant to software engineering as London Fashion Week is to someone planning an artic expedition.
Languages take a long time to become proficient in: I would guess about 4 years of full-time usage in an environment surrounded by experts. This precludes any individual ‘just trying a few’.
One definition of ‘better’ would be ‘How much more likely is my software startup to succeed if I pick language X over language Y?’ That might not be perfect, but would at least be economically rational. Measuring this probability directly is hard given the noise in the system, but if there was a strong advantage to picking LISP over PHP, then you would have expected someone to have out-executed Facebook during the early social network land-grab.
But the top 100 websites are dominated by so called ‘rubbish’ languages. Why?
Here are some possible reasons (but I don’t have any good ideas for tests to validate these)
- Hiring and the time to get productive in a language are important. During the critical growth phase of Facebook they were doubling headcount every 10 months. If it takes an extra 6 months for someone to be productive, then you have to be 50% larger to get the same productivity out of the team.
- Externalities matter.
- Fancy languages encourage fancy thinking, and developers tend to gold plate the backs of draws before building the desk.
- These common languages map better to the real-life problem domain. The designers of PHP said that they changed the language until it could succintly express common website tasks. It could be argued that they did this with ML, only the task was to implement a tiny ‘toy’ language.
- There is a very strong bias in the population of new startups away from ‘better’ languages.
Unix beat Smalltalk in the market. Why? One story is the old faviourite that ‘Marketing screwed it up’ by overpricing Smalltalk. Maybe, but what about another explanation.
Suppose that software doesn’t succeed based on how well it works in the environment it is designed for, but by how well it works in an environment it was never intended to be used in.
Unix was simple and portable. C could be ported to new platforms very easily, and the existing cannon of software put directly to use.
If you take a Linux system and chroot into a user space with no /dev /proc or /sys then a very surprising proportion of it still basically works. It is running completely out of spec, but you can often Get Work Done.
To travel to space you need a carefully designed, perfectly assembled vehicle that is tested and designed against a precise specification. To travel across Africa you take a rugged 4x4 and a set of tools.
Another aspect is how well it interacts with aliens. Take a Unix system and connect it via a serial port to your legacy mainframe and since everything is a stream of bytes, your mainframe is now a first-class citizen. Distributed garbage collection between two heaps is still a research topic, so that mainframe isn’t going to appear as an object any time soon.
This matters playing well with other systems gets all the functionality of those systems instantly and for free. Also, being easy to play with means that other people will value it and pay with either $ or code.