Will the good bits of JavaScript preserve the purity of a language such as Lisp, and the common touch of PHP?
IT’S STILL an open question as to how much, exactly, the nature of our spoken language affects how we think. If an Inuit language really had 50 words for snow, would that affect how the Inuit saw their world? If we didn’t have a word for the colour orange, would we see orange the same as speakers of other languages, or would it just look light red to us?
The techies who build the apps that keep the internet and its commerce thriving face similar questions – and for rather more practical ends. Every application has to be written in at least one of a Babel of computing languages.
Choosing the native programming language of a website, mobile or desktop application can dramatically affect how powerful the end result is, how easy it is to maintain, and who you can hire to write it.
Like Latin or ancient Greek, there are some languages with a reputation for attracting fine minds, but which are largely dead for practical use. I’ll get letters for saying this, but the Ancestral King of these largely abandoned tongues is a beautiful and subtle language called Lisp. There are many websites and complex applications written in Lisp and its dialects, but few professional Lisp coders.
Originally designed in 1958, Lisp appeals to the nobler instincts of the thinking programmer because of its purity. To Lisp, everything is a list of simple items. Programs are a list; the data they crunch upon is a list. You can write a list that creates a list, that can be run like a program. Lisp programs can write programs that, when you run them, write other programs.
This sort of abstraction might give you a headache, but it is like crack cocaine to great coders, because efficient coding frequently revolves around finding the most general solutions to specific problems.
Unfortunately, the truth of the computer industry is that we’re not all great coders: and sometimes, dreaming about ever higher levels of Platonic ideals can get in the way of shipping actual code. So most of us have found ourselves falling from the Eden of Lisp, and into more ugly but pragmatic languages.
Perhaps it’s just a sign of programming culture’s own inherent snobbery, but it does seem that the more popular a language, the greater its ugliness is deemed to be. The scrappy, triumphant populist of web programming languages has to be PHP, which originally stood for Personal Home Page but now bears the endless acronym expansion “PHP: Hypertext Preprocessor”.
PHP started as a quick hack to create web pages, and is still probably the easiest way to create a dynamic website. But low barriers to entry mean low standards of code and, while PHP’s eagerness to adapt to the need of every website author has meant widespread adoption, it’s also led to it being an unattractive mongrel of a language.
Writing Lisp makes you think, but sometimes you don’t want to think. I can vouch for the fact that you can write PHP while drunk, and it will still work. Just.
You’ll regret it in the morning, however, and plenty of websites have similar cause to regret their early PHP dalliances. YouTube was originally written in PHP; vast realms of Facebook still are.
It’s not that you can’t write great code in PHP – it’s just that if you’re not careful, you won’t, and maintaining such thrown-together code can be a real nightmare.
So, if Lisp is Greek and PHP is a dialect of fighting cockney, what is the real lingua franca of the 21st century? Oddly, it’s a language that has elements of each.
Originally written in a hurry to ship inside the first web browsers, its author snuck in some genuinely beautiful features that the world managed to ignore for more than a decade. The result is a language that almost everyone in computing knows a smattering of, but which turns out to have a hidden subset that can be used to create genuinely smart and maintainable code.
It’s called “JavaScript” – and you may have heard it, because it’s still running on many of the web pages you use (possibly throwing up an error or two, or begging you to turn it back on).
JavaScript used to be a nightmare of a language, a testament to what happens if you come from a bad home with wayward parents. Its given name was a marketing trick by Netscape and Sun to associate it with an utterly different language, Java. After that, things went downhill: Netscape, Microsoft and others wrote incompatible versions, and it never really escaped its browser ghetto or its early reputation as bug-filled and clumsy.
Then, Web 2.0 came along, as well as a new generation of talented web programmers who tried to work with the only resource at their disposal: the language wired into web browsers.
Now, desktop platforms such as Gnome, MacOS’s Dashboard, and even JavaScript are designed to run scalably on web servers such as Node.js, and Jaxer.
Will the good bits of JavaScript preserve the purity of a language such as Lisp, and the common touch of PHP? Or will its dysfunctional upbringing and incomprehensible portions drown out its renewed promise? Whatever language they speak, coders have an acronym for when we’ll find out: RSN, or Real Soon Now.