Page Body

Page Main

Post Main

Post Article

Code to Joy

Linked by Paul Ciano on August 20, 2018

Andrew Smith, 1843 Magazine:

There are now more than 1,700 computer languages that enable human desires to be translated into the only language a computer understands: numbers and logic. Most have been written by unpaid, clever individuals out of some opaque mix of glory and the hell of it. If you want to program a computer, you have to learn one of them. A daunting task, you might think. But even before that, you must engage in the hair-pulling frustration of picking your language.

To make my choice I trawl the web and consult every programmer I know. Each person either hedges or contradicts the last one. At first the litany of names sound like cleaning products or varieties of roses – Perl, Python, C, Ruby, Java, PHP, Cobol, Lisp, Pascal, Fortran. All have different specialisations and affinities that I feel unprepared to assess. Nevertheless, aided by websites that rank languages in terms of popularity on a monthly basis (the pace of coding fashion makes haute couture look agricultural), three scroll into view as not-stupid options: Python, JavaScript and C++. All are widely employed and on the rise, and have lots of fans and learning resources. Which to go for?

Ford steers me away from C++, which he likens to a shotgun: fast, efficient and ready to blow your foot off. If a misplaced semi-colon indicates a wish to erase the British archive of a major Hollywood movie studio – a friend of a friend claims this happened to him – C++ will follow through with unquestioning obedience. Not for me, I think.

JavaScript, by contrast, has the advantage of ubiquity: it is high level and serves as the primary language of interactive web pages. But it’s also hard to think your way into, which is the price it pays for having evolved chaotically – like the web – with no central authority. Devotees claim that JavaScript is improving rapidly, which sounds great until you consider that your hard-won skills might be obsolete in six months’ time. This fear haunts all coders and explains why they defend their own languages so fiercely, in what techies only half-jokingly refer to as “Religious Wars”. Like a lot of professional coders, Ford uses JavaScript and Python. He admires the latter, he says, for its svelte, modern syntax, its relative logic and versatility and the proactive disciples who generate lots of useful support. It has been used for everything from website development to algorithmic trading on the stockmarket.

…HTML goes hand in hand with Java­Script, which animates web pages. Try as I might, I am not enjoying the latter. I’m frustrated by its messiness and struggle to think my way into it. Perhaps coding is not going to be for me after all.

Aware that mature heads have been nudging me towards Python from the start, I return to one of these early advisers, who puts me in touch with a British programmer called Nicholas Tollervey, a graduate of the Royal College of Music and former professional tuba player. He has additional degrees in philosophy, computing and education – not like your stock coder cowboy. Fluent in a range of languages, he is a particular advocate for Python, which he teaches and develops tools for. Is there a reason people keep hinting I should try Python again, I ask?

“Well, I don’t want to get into Religious Wars here,” he says, “so I should say that I enjoy both. But yes, there is a reason.”

At the turn of the 1990s, Guido van Rossum, Python’s Dutch creator, set out to write a programming language that would be clear, concise and as close to natural English as possible. Simplicity was paramount and he wanted only one obvious solution to most problems. This was in explicit contrast to languages such as JavaScript that have an almost comic absence of overarching logic and syntactic elegance, and a baffling number of ways to do the same thing. Python does not encourage showboaters or individualists, because it prizes communication and collaboration. In Van Rossum’s words, “readability counts”. Intrigued, I decide to adapt a suggestion made months ago by Ford, setting myself the goal of writing a Python-based app with which authors can scrape Twitter for mentions of their books. Tollervey wishes me well and offers help if I need it.

I instantly appreciate the concision of Van Rossum’s layout, which, like written prose and many other programming languages, uses indentation to delineate blocks of code rather than littering the screen with symbols (such as arrays of brackets and braces) to achieve the same result. JavaScript often looks as though a bowl of Alphabetti Spaghetti had been sicked up on the screen; Python is uncluttered and comparatively easy to take in at a glance. I am shocked to understand that my affinity for Python is primarily an aesthetic matter, a quirk of my own temperament. I’m beginning to understand why it is that particular character types cluster around different languages.

“The thing that gets lost,” he says, “and which I think is important to know, is that programming is never easy. You’re never doing the same thing twice, because code is infinitely reproducible and if you’ve already solved a problem and you encounter it again, you just use your old solution. So by definition you’re kind of always on this frontier where you’re out of your depth. And one of the things you have to learn is to accept that feeling – of being constantly wrong.”

Which makes coding sound like a branch of Zen Buddhism.

A stray parenthesis had thrown the whole program into chaos. Tollervey removes it and the code works. I stare at the screen in disbelief. We’re done. Too wired to sleep, I stay up talking to Tollervey about programming for another hour. My app is crude and unlikely to change the world or disrupt anything soon, but it feels amazing to have made it.

More powerful than any of this is a feeling of enfranchisement that comes through beginning to comprehend the fascinating but profoundly alien principles by which software works. By accident more than design, coders now comprise a Fifth Estate and as 21st-century citizens we need to be able to interrogate them as deeply as we interrogate politicians, marketers, the players of Wall Street and the media. Wittgenstein wrote that “the limits of my language mean the limits of my world.” My world just got a little bigger.

Paul Ciano

Enjoyed this post?

Subscribe to my feed for the latest updates.