JavaScript

Sam Myres
3 min readFeb 18, 2024

But why?

Dall-E “a person (symbolizing you) standing at a crossroads, looking puzzled. On one path, there’s a signpost pointing towards a vibrant city made of code (representing the complex, modern JS like React). On the other path, there’s a serene, straightforward path leading to a server tower surrounded by classic programming language symbols (PHP, Perl, Go, Python).”

I won’t enumerate the many failures of JavaScript in their entirety. We know, of course, that Mr. Eich the original author of the language agrees that he took some bad advice about type coercion, for example.

Instead, this is a personal beef. JavaScript has professionally and personally been a pain point and seems to have had a diminishing use case in my mind as long as I’ve been programming. Need to animate something? CSS3 is fine. Want to create some HTML? probably want to just render that on your server with a statically typed language, as many times as the JavaScript community has figured out how to “hydrate” or do server side rendering.

I got my start when jQuery was truly king, 2014 and it seemed like the $ notation was some kind of borrowed magic from PHP to my inexperienced eyes. I think I understood that the primary benefit was a kind of backfilling functionality for the Internet Explorers of the world. Thing were simple enough, because I was taught PHP I was simply generating html and $.get()ing it back from the server to append on a click or something.

I slowly slipped further into the backend role where I just didn’t have to keep up.

Revisiting newer ‘vanilla’ javascript this year, I’ve learned I don’t really want to use the tool, even if it is the only real procedural language in my browser (without a compile step).

Why though? I haven’t really learned enough about the language to have any right to criticize it, at least in my own opinion. Why can’t I just get over myself and just use the stupid thing and make a beautiful SPA in React or something?

I think it’s just because I know I don’t have to use it. There are many things that many people do not do because they do not have to, and in all of my time programming things for myself for the web, I’ve never really found a case where I couldn’t server side render or just accept form inputs from a user with <form> .

Between PHP, Perl, Go and Python, all the languages I’ve served some web content from, not a single one of them necessitates the use of javascript. In PHP, you can check the length or truthiness of $_POST and in Perl probably something similar to $_ and so on and just process form data at the same page and redirect to the result.

This is what I’ve been doing with Go in all my personal projects now, too. I’ll probably switch to the new routing in 1.22 soon which can at least separate GET and POST, but for the most part I’m happy with this approach. Nothing about me wants to type the letters node or npm on my console even if it is passingly similar to the code I would be writing on the front end, if I found some reason to do so.

Honestly I’m just confused. This tool does have to exist for certain reasons and I get why React helps prevent callback hell or really confusing dependency graphs and all the rest with a giant frontend app like facebook, but even facebook started with PHP and server side rendering everything with cgi through Apache.

If I’m wrong, I’d love input from the crowd. Why should I try javascript everywhere ? or the frontend? or the backend?

--

--

I'm a Software Engineer, FAA 107 Drone Pilot and Radio Amateur. I write about things related to SWE and Tech and my own projects.