I subscribe to JS Weekly to try and keep up on the amazing monster that JavaScript has become. What with V8, node.js, and asm.js, everybody* thinks that JavaScript is the god damned cat’s meow nowadays. Well, not me – I think in a decade or so, it’s going to be about as relevant as the phrase “cat’s meow” is today.
What makes me think this?
* everybody who hasn’t seen the rise and fall of many other trendy-but-stupid technologies, anyway
Node.js
Well, for starters, node.js. Don’t get me wrong, it’s all right for a very simple real-time server that does one or two simple things. But beyond that, it’s just a pain.
Node.js is a chore when it comes to building even a semi-complex web app. Express and connect and all that stuff just utterly fail at making node.js not suck. JavaScript is an okay language, and it has some really neat tricks for sure – but node.js is plain and simply crap. The only selling point seems to be that it lets you code JS on the front-end and the back-end, but even that isn’t really all that important. Every damn language today can serialize to JSON, and anybody with a tenth of a brain cell knows you don’t want to share your complex data structures across the network – both for performance reasons as well as security reasons. It’s just way too easy to share the wrong stuff when you have a simple “sync all the things” library (ahem, lookin’ at you, nowjs, you fucking pile of rejected fecal matter). You share as little as possible, and use RPC calls carefully to avoid syncing huge amounts of data. The node.js advantage here is completely meaningless to a good developer who understands basic fucking concepts of programming.
But wait, there’s more! Much like the trendy framework Rails, node.js doesn’t do multi-threading, which means you end up running multiple instances of your app in order to use your 8-core system. Yeah, that’s a cool idea. So when node.js is touted for being blazing fast, what they mean is it’s blazing fast for trivial tasks that don’t need parallelization.
Then there’s the lovely world of callbacks. Oh, god, the callbacks. Need to run A() after B() runs but only if C() and D() return the right values? Enjoy yourself. What can be done in a couple lines of PHP, Python, Ruby, or any other sane language take gobs of callbacks to achieve. Async can help a bit, but not nearly enough when you have things that really need to happen based on the result of other things. It’s nice when you don’t have complex logic that relies so heavily on external function calls, but sometimes it’s unavoidable, especially when true OOP is frowned upon by the JS zealots.
And the funny thing is there are already ways to get nodejs-like performance. Twisted in Python is pretty much nodejs but with a nice language, threading, and no forced callback BS.
asm.js
Well, asm.js is a huge hack. Pretty sure nobody sane disagrees here. It’s just that some people actually think it’s a good idea even though it’s a little hacky.
Asm.js keeps us trapped in JavaScript, with the One Language To Rule Them All mentality that keeps garbage like Java alive and kicking years after it should have been stripped and sold for parts.
Asm.js just makes JavaScript faster. But not the JavaScript you and I write – special JS that nobody would ever write by hand, and which actually tends to be compiled from other languages. So instead of just admitting JS isn’t a good fit for the 21st century, we instead talk about how wonderful it is by showcasing how far compilers have come to let us NOT write JS.
What is so great about asm.js? Well, it’s still JS so you don’t need any special technology to run it! Oh, unless, of course, you’re counting on that performance it offers… and if you’re not, chances are you’re not doing anything interesting enough to warrant having compiled unreadable and unmaintainable asm.js.
See, this is the problem I have with this sort of “solution”: it’s a technology built presumably by very smart people, but some of their main marketability is just fabricated. I’m not going to run something powered by asm.js in a browser that doesn’t support it at any reasonable speed. So the claim that it “just works” is a bit like saying an app compiled for 16-bit x86 systems will still run on a 386. It may indeed run, but not at any usable speed, unless the app isn’t doing anything even the tiniest bit stressful on modern machines….
Incidentally, one of the things asm.js does to be speedy is that it avoids garbage collection. One of the “pinnacles” of modern programming is dropped because it kills performance (and incidentally this is why iOS apps are so fucking speedy – thanks for Java, Google, my quad-core Android fucking sucks compared to a five-year-old iPad). One thing almost all devs suck at is memory management – it’s hard. But GCs come with a pretty high price, so let’s keep that in mind for the next big trendy thing you morons come up with.
So anyway, let’s all be honest. JS isn’t great, especially for mobile apps. Some kind of low-level bytecode is the right solution. asm.js isn’t low-level bytecode, it’s what JS shits out after eating too much authentic Mexican food. pNaCl may be a better fit than asm.js, but honestly ANYTHING low-level would be better.
JS Weekly
So back on topic here. JS Weekly sends me a weekly (imagine that) email about JS technologies. Here’s one of the articles that was featured: http://tech.pro/tutorial/1669/21-javascript-parts-i-struggle-to-remember-. If you read those 21 items and don’t scream out, “OMFG developers have really gotten stupid”, then you’re part of the problem. Half of that stuff isn’t even JS-specific (short-circuiting via &&
and ||
? REALLY?), and most of it is obvious, or at least sensible, to anybody who is worthy of being called a “junior software developer”.
This list is a fucking tragedy. 9/11 wasn’t even this bad, folks. This is just apalling and an embarrassment to the profession as a whole. This is why software is shittier and shittier every day. The vast majority of “developers” don’t understand 90% of what they’re doing – they copy and paste from Stack Overflow and scratch their heads for days when they forget a comma.
So, in conclusion
I’d like to believe these insane ideas, and in particular the incompetence of that JS Weekly guy, didn’t represent the average programmer. But that’s just wishful thinking. Having been around the block a while, it’s become painfully clear that writing good code is a dead art. And the reason all these trendy new techs pop up isn’t that they’re actually better than last year’s trend – the developers simply wrote such shit code they can’t maintain it anymore, and blame the technology because they’re too fucking useless to realize how fucking useless they are.
And for the record, I like Mexican food. But sometimes it doesn’t agree with the bowels. That’s all I was saying. I’m okay with insulting stupid developers, but NEVER Mexican food. I only wish Oregon had more Mexican food options that don’t suck as much as the average software professional.
Oh, and WTF is with the top of that JS article I posted? It’s got a big ol’ “Advanced” label at the top. Advanced for whom, precisely? Does that site (tech.pro) host a lot of stuff for kindergarteners or something? Shit. Now I’m really depressed.