Published
- 3 min read
Thoughts on Javascript
Stockholm Syndrome as a Service
I remember the first time I wrote JavaScript, after exclusively using C++ for years. I wanted to make a button fade out when clicked. I used jQuery. $(this).fadeOut(). It felt like magic.
If you had told me then that just a year later, I would be compiling TypeScript into JavaScript, running it on a server (Node), to render HTML (React), to hydrate it on the client, managing state with two different libraries, and arguing about signal-based fine-grained reactivity… I would have asked you what drugs you were taking.
And yet, here we are.
The Churn
Being a JavaScript developer is like living in a house that is constantly being renovated while you are inside it.
- “We use Grunt.”
- “No, Gulp is better.”
- “Actually, use Webpack.”
- “Webpack is too complex, use Parcel.”
- “Vite is the future.”
- “Actually, let’s go back to server-side rendering with Rails… wait, I mean Next.js app router.”
My soul is tired. I have learned to define Components as classes, then as functions, then as functions with hooks, and now I’m hearing about Server Components which are functions that don’t run in the browser but look like they do?
Pass me the blunt.
”Undefined” is Not a Function
JavaScript was written in 10 days by Brendan Eich, and I sometimes wonder what he did for the last 9 days.
I can give you examples of how it is a language that tries to be helpful to a fault. “Oh, you want to add a string to a number? Let me just concatenate that for you.” NO. I DO NOT WANT THAT. I WANT AN ERROR.
I have spent cumulatively months of my life debugging issues that were simply undefined passing silently through fifteen layers of abstraction until it crashed a render function in production.
This is why I have the TypeScript logo above my bed.
The Universal VM
But… (and there is always a “but”).
JavaScript is the most important programming language in human history.
This is a hot take, I know. But JavaScript has Reach. Everything with a screen runs JavaScript. Your phone, your laptop, your TV, your fridge, the chaotic advertising display at the mall. It is a universal human interface.
If you can write JavaScript, you can ship software to 5 billion people instantly. No installers, no app store approvals (mostly).
Ecosystem of Chaos
NPM is the Library of Alexandria, managed by a horde of drunk raccoons. There are packages for padding strings, simulating the physics of a jelly donut, and engaging in high-frequency trading. But node_modules is the heaviest object in the universe. (other than, well, you know…)
The collective intelligence of the JavaScript community could be the world’s largest distributed computing experiment.
Making Peace
I have gone through the stages of grief with JavaScript.
- Denial: “I’ll just write backend code.”
- Anger: “Why is
thisundefined???” - Bargaining: “Maybe if I use Elm/ReasonML/ClojureScript…”
- Depression: “I am just a yaml configuration engineer now.”
- Acceptance: “JavaScript is fine.”
I’m glad it doesn’t listen to the haters. It is the punk rock of programming languages.
And here I am, configuring my fifteenth eslintrc file, getting ready to build something cool.