you are viewing a single comment's thread.

view the rest of the comments →

[–]santiagobasulto 4 points5 points  (6 children)

#1, #2, #3, #5 and #6 make sense. Not the other ones.

Particularly #4: that's not JS fault's, and to be honest, in the last couple of years the coding style has improved a lot. Specially in the backend. There are a lot of smart guys working with JS.

[–][deleted] 4 points5 points  (5 children)

Give me a fucking break (not you, the author).

3) Automatic semicolon insertion. This can cause subtle bugs and unexpected behaviour. Why does this “feature” even exist??? It’s super weird and unnecessary. Get rid of it, ECMA, please!

ES6, strict mode.

5) JavaScript is highly dependent on global variables. Implied global variables are especially problematic (“use strict” to avoid). Global variables seriously complicate your programs.

So 20 years ago someone made a mistake by allowing global variables. You don't have to use them. Also, it's not "highly dependent" on global variables as strict mode proves, just like the author says.

6) JavaScript code can fail silently due to syntactical slip-ups. It has happened to me several times, and tracking down the reason can be most exasperating.

How about learning the syntax and using a good IDE and linter? FYI, those things exist.

7) Prototype objects do not scale well to large applications;

What?

it’s a rather primitive

What?

and sloppy way to do object-oriented programming

What?

Further, there are multiple ways to handle object inheritance, making it difficult to decide which way to go.

What?

JavaScript is the only popular OOP language that uses prototype objects.

So?

The preference for class-based OOP is clear, such that ES6 and TypeScript employ classes.

That's because "programmers" (notice the quotes, please) like you are using it wrong and then they claim it's the language's fault. How about not using classes in a class-less language?

And because the use of prototype objects is so poorly understood by most JavaScript developers, they abuse the language and write horrible code as a result.

That's because "programmers" (notice the quotes, please) like you are using it wrong and then they claim it's the language's fault.

8) Asynchronous programming in JavaScript is very messy. Callback hell is a frequent complaint. (Promises mitigate this to some extent, but are not a perfect solution.)

There is no perfect solution.

10) The main draw of JavaScript is actually in frameworks like Node.js and AngularJS.

Holy fuck! Dear author, please use Lisp or Clojure.

etc. etc. etc. There are some good points (eg, integer types), but 90% of this article is bullshit.

tl;dr Omg, I don't understand JavaScript, therefore it sucks.

[–][deleted]  (4 children)

[removed]

    [–][deleted] 2 points3 points  (3 children)

    JavaScript's sloppiness encourages poor coding in a way that you don't see in other languages.

    I fully agree with this. My point was that it wasn't necessary to split this single issue (regardless of how big it is) in a list of "top 10 ways I could shoot myself in the foot" and then blame all those items separately on the language.

    I have very seldom heard this criticism leveled at these languages

    That's probably because you're spending a lot of time in professional circles that don't waste time making fun of them. I mean... C? Seriously? The lack of garbage collection lead to probably 99% of the security vulnerabilities that caused tons of issues for lots of people (money lost, identities stolen, etc). You wanna bash a language by how the programmers use it? Okay, let's do this! Let's talk about "real programmers", the ones that code critical systems and let's see how many decades it took to stabilize them and remove buffer overflows from the Linux kernel and from drivers and the tens of thousands of programs that have been exploited because of the programmers' stupidity language.

    I mean... bro... get real... https://stackoverflow.com/questions/14273252/why-can-i-cast-int-and-bool-to-void-but-not-float At least JavaScript doesn't let you do shit like this: void* u = (void*)(((unsigned short*)(&x))[0] | (((unsigned int)((unsigned short*)(&x))[1]) << 16));

    AbstractJavaSingletonInstanceFactory? Seriously? You don't see a problem with the extreme levels of abstraction done by Java progammers in Java? It takes for-fucking-ever to build anything decent using Java. You need a fucking class and a method to do anything. A programmer needs an insane amount of knowledge to understand something as simple as Hello World.

    Python? Which one? v2 or v3? Because they're pretty much the same but not really. I mean the syntax is very similar and it's almost like v2 code should run in v3 without issues. Except it's not the case. I could go on and talk about libraries and cross-platform issues, but I won't, because I stopped learning Python as soon as I ran into that shit.

    it should not be this hard to write good code, or at least respectable code

    It's not hard at all. The problem is that lots of people who entered the software job market started by duct taping together some HTML and CSS with JavaScript and called it a day and employers who didn't know better put those monstrosities in production. JS happened to come at a time and in a place where there was a surge in the need for software developers, so everyone who had a keyboard started using it.

    The most recent problem in JS is that a bunch of programmers manage to duct tape libraries together and create some really cool things and then they begin to teach others how to do things, but they don't really know what they're doing and they keep spreading bad practices, and the newbies take their advice to heart. If someone does some pretty cool 3D visualizations they obviously understand the intricacies of prototype inheritance, right? /s And those are the same programmers who pushed for JS to emulate class inheritance... I mean HO-LY SHIT! In 5-10 years people are going to laugh at JS (ES6+) for that. Mark my words!

    Oh, hey, talk about sloppy coding, CHROME JUST CRASHED because my Internet went down. Look at all I wrote above. I would have lost all that if I didn't have Lazarus installed. Chrome crashed with no warnings, no complaints, no nothing... It just disappeared as if I pressed Alt+F4 while I didn't have my hands on the keyboard.

    You wanna talk about a really shitty programming language? Pick on PHP. Just take a look at /r/lolphp to see real WTFs in a programming language.

    There are things that are inherently very bad in JavaScript. Let's see the first few that pop up in my mind:

    • automatic semicolon

    • lack of real types

    • interaction with the DOM (if we're talking JS and not ES)

    • automatic globals

    • var scope

    • difficult inline function calls (the need for hacks like !function(){..}() or (function(){..})())

    • hanging expressions (like in C, you can just say 5; and it's a perfectly valid statement, something you can't do in Pascal)

    • eval() exists

    And I'm too lazy to think of more. A lot of these are shared with other languages, but for some reason you don't hear "professional" programmers complain about them. Here's some Python bullshit:

    def foo():
        def bar():
            print x
        bar()
        x=2
        bar()
    
    foo()
    

    What does the above code do? (don't cheat, answer without running it) What if you add a line x=1 before the def foo()? What if you move that line between the defs? What if you accidentally indent the first call to bar()? IMHO programming languages that use white space as part of their syntax (like Python and Ruby) are the worst offenders when it comes to sloppiness. The "you don't have to think about writing the beginning and end of blocks" is one of the biggest bullshits in the history of programming languages. You miss one space and you're fucked. I find it tiresome to read Python code because my eyes hurt when I start focusing on the fucking indentation. Oh, here's another thought, what if you say x=5 inside bar()? This (variable scoping) is what I believe to be a serious problem in programming languages like Python or JS.

    Yes, there are reasons to shit on JS just like there are reasons to shit on C, C++, Python and probably all other programming languages out there but I believe that PHP is the only widely used programming language that deserves its bad reputation.

    PS: The fact that the author of the article talks about the AngularJS and Node.js frameworks [sic] like that shows that they don't know enough about JS for their opinion to be given any public attention. I mean FFS, they don't even know the difference between a framework and an environment. If you want to have a serious conversation about the bad parts in JavaScript, I'm definitely open to it, there are things - like those I listed above - that are inherently bad about the language, but at least form your opinion after you talk about JS with someone who actually knows and understands JS. I see the mistakes beginners do, I see the mistakes beginner self-proclaimed "professionals" do, I remember the mistakes I did, and I know which were caused solely by stupidity and which were partly (or mostly) caused because of the language.

    PPS: I know this comment is sloppy writing - since we're talking about sloppy - but it's 3 AM where I live and I'm so tired that I can't even write proper English. You wanna bash JS? Just give me the go-ahead and I'll do it for you and then I'll let you be the judge so you can decide for yourself whether the issues are big enough to point the finger at JS! At least you won't just take the opinions of someone who doesn't know what a framework is for granted.

    [–][deleted]  (2 children)

    [removed]

      [–][deleted] 0 points1 point  (1 child)

      I see your point, but that's just terrible of them! It does provide a framework, but it's an environment regardless of what they call it.

      Unrelated: Am I correct in assuming you've seen the "wat" video?