Learning JavaScript as a foreign language

_nology trainee David comes from a background in foreign languages. However, since joining the _nology course he has discovered that his passion lies in programming languages.

Written by Nology Team - 15.07.20

“Programs must be written for people to read, and only incidentally for machines to execute.” ― Harold Abelson

I’ve always defined myself as a linguist. My A-levels were French, German, and English Literature, and my degree is in Chinese Studies. In looking for a career that would suit an aptitude for languages, I was banking on the idea that there would be some broad overlap at least between the grammar of human languages and the logical flow of programming languages. (I recently discovered that this is in fact true!)

I’ve just completed Week Eight of the _nology software development course, and I’ve found that the transition from natural languages to programming languages has been a positive delight. Programming languages, it turns out, have some features which natural languages just can’t offer.

Pronoun Precision Problems

Human languages are full of ambiguity. The “gay fanfiction dilemma” is a classic example. “She played with the hem of her skirt” is a semantically infuriating sentence, because the pronouns give us no useful information about how many people are involved in the interaction, or what their roles are.

You wouldn’t really be able to get away with this in JavaScript, unless you were trying to be deliberately difficult and making use of outdated syntax. Variables, the developer’s equivalent of pronouns, have to be declared and referenced with exactly the same sequence of alphanumeric characters. So it’s always going to be something like “this.playWithHemOfSkirt()”, or “personOne.playWithHemOfSkirtOf(personTwo)”. (Hey, maybe I should write fanfiction!)

Eschew Obfuscation, Espouse Elucidation

Lively, engaging prose can grab your attention and communicate exciting new ideas.

Notwithstanding the aforementioned, there remain innumerable indubitably inferior means by which novel concepts can be lost to pleonasm and prevarication, being delivered via constructions which, though grammatically valid, nevertheless create arbitrary linguistic obstacles, past which a reader has trouble getting.

I’m a big fan of React’s “Failed to compile” message. If I write code which makes no sense to its primary audience—usually a browser—it simply won’t run, and usually it tells me exactly why.

In a well-structured project, there are so many layers of checks—IDE syntax error checkers, linting, unit tests, integration tests—that there is simply no way for basic, poorly thought-through nonsense to end up in production. And for complicated, carefully thought-through nonsense, we have pull requests and code reviews.

Natural languages would lose some of their finest features if rigorous checks and balances were in place. “Covfefe” would never have happened for a start. But strict syntax and clear logic are a linguist’s dream. They provide a solid foundation and a well-defined toolkit with which you can start building. You can publish an article even grammar if the is wrong, but you can’t run code if the syntax is anything less than perfect.

The Curse of Canon

Writing is like art; in that it has a peculiar tendency of gaining value by having a sustained impact over time. Fluent, idiomatic English owes much to authors from hundreds of years ago. It’s much harder to create a proverb, idiom or turn of phrase that resonates with people than to directly invoke some Shakespearean rhetorical flourish into your writing. Meanwhile, imitating archaic expressions from Old Testament writings is a much easier way to convey a sense of authority and grandeur than coining a neologism.

When it comes to non-fiction, though, I much prefer new ideas over old ones. It’s quite refreshing as a programming linguist to find that you don’t really need to look in to the past to become a fluent developer. It can’t hurt to know jQuery, but at the same time, there wasn’t some heyday of JavaScript prose a few hundred years back that is essential to understanding programmer culture. The most succinct, useful and expressive features of the language are usually the ones which have been added most recently.

In a way, creative writing is “callback heaven”—the more you can reference how widely read you are in your writing, the more people will take you seriously. For programmers though, we only know “callback hell”—using outdated syntax from an inferior incarnation of a language is never going to be better than using the most up-to-date features it has to offer.

Learning to code with _nology is one of the best decisions I’ve ever made. As a linguist, it’s new, exciting and engaging. And as a budding junior developer, I’m learning a particular set of skills—skills which, thankfully, won’t make me a nightmare for anyone, but will help me add value to whoever I work for in the future.

Sorry, English, French, German and Chinese. I’m taken.

Posts

Related Stories

Launch a future-proof career. Discover how you could learn to code, and transform your career by joining the _nology 12 Week Software Developer Course.

When I was younger my passion was chemistry As a teenager, I was obsessed with making fireworks. This hobby sparked an interest in Chemistry which led me to...

Read More

August 21, 2019

I grew up surrounded by computers – and I mean this literally My dad, a superhero without the awkward Spandex suit but with some knowledge of just about...

Read More

September 14, 2019