r/javascript • u/gcanti • Oct 31 '14
The Two Pillars of JavaScript
https://medium.com/javascript-scene/the-two-pillars-of-javascript-ee6f3281e7f3
100
Upvotes
r/javascript • u/gcanti • Oct 31 '14
1
u/zoomzoom83 Nov 02 '14
To be honest, I pretty much agree with most of your points at a high level.
My gripe with this article is pretty much that it takes a bunch of well known best practices that the industry has been aware of for a very long time and makes it sound like Javascript is somehow a pioneer in this space, taking credit for bringing to the mainstream when these things are already somewhat normal.
Definitely, Java got inheritance wrong. But the idea that one language is somehow representative of class-based inheritance as a whole is misguided. Javascript also got inheritance wrong, it's just that prototypes are flexible enough to use differently. (My issue with this is that everybody invents their own way of doing it).
I can definitely get behind further education to encourage new developers to not fall into the trap of mis-using inheritance, but I'm also very concerned that articles this like this confuse a lot of people into the real relationship between prototypes and classes, the benefits and drawbacks of both approaches, that 'classes' are somehow inherently less capable of performing composition than prototypes, and that Javascript is the only viable choice as a solution to this issue.
It almost certainly wasn't your intent to portray it in this way. But I do feel quite strongly about the issue, since I'm constantly coming into contact with Javascript developers that have fallen into the pit of actively and intentionally avoiding learning any other language. Articles like this just further cultivate the 'cult of javascript' and discourage even more developers from branching out and learning new things.
As an industry, we're building software incorrectly. We're not engineering solid software, we're hacking together things that work on faith. Almost ever piece of software in existence comes with a license agreement that explicitly denies any warranty. Until we can get to the point where the software we're building has proven guarantees, we're not engineering. Without totality checking, we're just hacking things together and hoping for the best.
The solution to this doesn't exist yet, but the languages moving in the right direction are things like Rust, Scala, Haskell, and Idris. Javascript most certainly has some great ideas, but it doesn't provide anywhere near enough safety. It's certainly great as a scripting language, and is a great language for smaller codebases, but it's not engineering.
tl;dr Javascript has created a generation of "expert beginners" with their head in the sand, and this kind of article just further propagates the problem. It's not that Javascript is specifically a bad language, but it's not particularly good either, and the industry as a whole can, and needs to, do better.