Coming into Node.js from Other Languages 🤦‍

What the hell is happening right now?!

Warning: I’m about to sound like a complete troll.

Recently I have been moving into the World of Node™. It’s where my company needs me, and I go where I’m needed. I’m a fairly-experienced developer; not a hard-hitter the likes of Matz or Dave Cheney but not a noob either. Before Node it was Go. Before Go it was Ruby. Before Ruby it was Java. Before Java it was PHP (shudder) and some client-side JavaScript all along the way. That last one is worth noting. I’m sure it’s a frequent situation: old-school front-end coder decides to go server-side with Node and is completely shaken by how massively different the paradigm is than client-side JavaScript. Hell, even with ES6 the syntax has changed so much that it’s barely recognizable.

I’ve been at it full-time for a while now — for around three months or so, along with working on a few React-related issues over the past year. It’s not like I’d never seen nor heard about Node; I’d have to live in a vacuum (what developer didn’t get a slight chuckle out of the left-pad scandal that rocked 2016?). I’ve been at it, yet I still have my issues with it.

Unconventional Conventions

A little reflection on Go (pun intended) leaves me pleasantly joyful about the simplicity of having 25 keywords in the entire language along with a standard code style that’s no one’s favorite, yet everyone loves having. The same can even be said about Ruby to an extent, with the community’s push toward standards of formatting and readability, though I have my qualms with some of the standards, as I’m sure everyone does.

Now let’s talk about standards for Node and modern JavaScript. Wait, which one? Is it just me or is the Node/JS community as split on standards as the 2014 US Congress? The one standard everyone seems to agree on is the one standard that frankly pisses me off: how the hell am I supposed to read this sh*t with two-space indentation? It’s one of the things I disliked about Ruby as well, but at least Ruby didn’t have a cacophony of unreadable “ ‘, ( & [ . )” crap going on. But hey, it could always be PHP.

Also, can someone please tell me why I have to learn 4,762 different ways to skin an asynchronous cat to get anything done? Okay, there may not be that exact number of ways, but — for crying out loud — stop it already. Promise me this, callback me that, async me down a waterfall on the River Styx; go on, I’m awaiting.

I’ve heard Node developers laud the flexibility and power of server-side JavaScript. They’re not wrong, but along with this flexibility comes some pretty damn heavy complexity and confusion.

More Packages than an Amazon Warehouse

This one isn’t so much a technical beef with Node (after all “Node” implies modular functionality and is great in some circumstances), but is more an argument with the Node community. It seems there’s a plague — a veritable sh*t storm — of willy-nilly “npm install --save” commands showering the terminals of Node developers worldwide. A web framework becomes “lean” by installing 291 modules. With that number of dependencies, it’s not surprising your code is lean. And by the way, Hot Pockets are disgusting.

How about a little due diligence on researching dependencies before installing a module? Thanks for your service to the community, @jdan.

The MiddleClass()

From the ECMAScript Language Specification:

ECMAScript is an object‑oriented programming language for performing computations and manipulating computational objects within a host environment.

From Java to Ruby to later versions of PHP even (showing my age here), use of classes has abounded in my work with these languages. OK, I’ll grant JavaScript the title of object-oriented — I guess. It’s prototypal specification is great, just great; it’s definitely in the top ten of prototype-based languages. It actually may be number one, though I’m not sure; Lua and NewtonScript are sure popular.

I have an idea: let’s alter the core of our objects at run-time by changing the prototypes and confuse the hell out of developers using them because it’s not in the original object definition.

Fifteen years into the Twenty-First Century, the “Java” in “JavaScript” finally becomes less confusing by including the “class” keyword. Thanks for the sugar.

So…

My WTF Meter® just keeps climbing as I dive deeper into ES6 and Node and the endless myriad packages. I’m not sure, but my experience with the whole “learning” thing has been that things become clearer as time goes by, not more confusing. But, a man can hope. Maybe this is one of those “Bell Curve” deals. Anyway, I remain on the path. Wish me luck.