Hacker News new | ask | show | jobs
by epicide 2807 days ago
This is what I try to convey to a lot of people who keep making jokes about JavaScript being unpredictable and hard to program.

Just like everything else (especially programming languages), you are limited by your understanding of the concepts. It's only as difficult as you make it.

I think so many people think of it as a toy, never bother to actually learn how it works, and assume everything either does or should work like it does in other languages.

4 comments

>you are limited by your understanding of the concepts. It's only as difficult as you make it.

I disagree. It is very possible to understand a concept fully, but for it still to be hard. E.g. pointers are quite easy to grasp the concept of, but also very easy to mess up. A more related example would be JavaScript's type coercion. Just understanding it, doesn't make it easy to avoid overlooking places it will cause problems. So some features programming languages include can be objectively considered harder than others, even when you fully understand them.

We're migrating an app from Ruby to NodeJS, and I keep hoping it'll get better, but everywhere I look, from the inconsistency and constant shifting of language semantics to the immaturity of the ecosystem, and how the former practically enshrines the latter, I can confidently state that Javascript is an objectively worse language. Attempts to solve problems caused by Javascript only make the whole thing worse.

At the moment, I actually prefer vanilla javascript to ES6-7. ES6 is inconsistent in awful ways. You still can't rely on bindings to stay put and new additions like the splat operator just don't work the same way all the time.

The more I learn JS, the more I hate it. I think eventually the web development community will come around, Node will lose mindshare, and compile-to-js languages will find their place in the sun again.

I suspect that people who actually like the language are experiencing a form of Stockholm Syndrome.

> I actually prefer vanilla javascript to ES6-7

ES6 is vanilla JavaScript. Most modern browsers have support >98% of added ES6 functionality for several major versions at this point. Admittedly, Node.js is still lacking, but it's getting there.

> You still can't rely on bindings to stay put and new additions like the splat operator just don't work the same way all the time.

Unless you have a bug to report about undefined or non-deterministic behavior, then it must be something you're doing. Random functionality is not intended behavior.

> eventually the web development community will come around... and compile-to-js languages will find their place in the sun again.

This is implying they were ever there. The big ones that come to mind were terrible. They would produce way more bloated frontends than anything we see today. In general, adding a layer of abstraction can be incredibly useful sometimes, but they can come at a steep cost.

What you include in "compile-to-JS" does get a little tricky to define, though. Things like TypeScript or even Babel can kind of count here. I think we will likely continue to see these, but I seriously doubt we'll see a resurgence of anything like GWT again.

> I suspect that people who actually like the language are experiencing a form of Stockholm Syndrome.

Sure, but the same can be said for anybody working with computers ;)

> Unless you have a bug to report about undefined or non-deterministic behavior, then it must be something you're doing. Random functionality is not intended behavior.

You wouldn't be saying that if you ran into the behavior we have. Eventually I'll do more digging to find out root cause. But there's no way it was us.

> I seriously doubt we'll see a resurgence of anything like GWT again.

I'm thinking more along the lines of CoffeeScript. It bifurcates the landscape even further, but honestly I don't think it can really get any worse than it is now. But at least it will be building on top of sanity and not the lava layer.

I learned to embrace platform languages, regardless how I might feel about them.

Not having to deal with extra debugging layers, lesser debugging tools and additional manual FFI is much more productive than whatever I might gain in syntax/semantics of the "compile-to" language.

Node is identical to Ruby in all these ways. How man Ruby gems no longer exist that countless web apps used to depend on? How many backwards incompatible changes has Rails made?
Were there any tech reasons for switching from ruby to node?
Sadly, no.
Thanks, I was just wondering since I don't really see the point in rewriting between dynamic languages. Aside from a few things being easier in each (async being an example) they're basically the same to me.
> It's only as difficult as you make it.

Or as difficult as the authors of the code you're using made it.

Oh absolutely. No language is immune to bad code and bad APIs. A good developer experience requires diligence. That starts with a good understanding of the language.
"Just like everything else (especially programming languages), you are limited by your understanding of the concepts. It's only as difficult as you make it."

No - JS is a special beast. Because it's designed from a simple hack on up, by distributed committee, with so many implementations ...

it's inherently problematic.

Foremost - when you say 'JavaScript' what does that even mean? Even different JS versions are implemented slightly differently with some containing features, others not.

It's this tedious, byzantine aspect of JS that makes learning it actually hard, because it's like walking on shifting sand.

At least with Java (and most other languages), there is usually one answer however bad or good, usually you know where you stand.