|
Why do people hate JavaScript? Is it because you're mixing it up with the DOM, especially the DOM of Internet Explorer of yesteryear? If so, scripting IE 6's DOM with Python would have been just as perilous. Is it because you're mixing it up with Node.js, and its asynchronous complexity? If so, JavaScript doesn't have to work that way. And other languages could have been used the same way. Say, Node.py or Node.rb. Conversely, JavaScript could be framed in a normal, FastCGI apparatus, where everything runs more or less straightforwardly. Is it because you're mixing it up with the messiness of NPM? See above. Is it because JavaScript is dynamically typed, or because it has some other characteristic that seems less serious than languages like C, Java, or Go? If so, why not the same hatred for Python, Ruby, Perl, and Lua? I myself like JavaScript's syntax more than all of the other scripting languages. I think the syntax for object literals and array literals is pleasantly terse. So is the dot notation for attributes. Combine that with how functions are first class, and you can chain them with dots instead of nesting them in parentheses. I like the new arrow syntax for functions, making the code even simpler. |
I don't hate JavaScript, but I do dislike it. After advancing in my career and becoming a back end engineer I strongly prefer the type-safety of strongly typed, typically compiled, languages.
I've worked in large dynamically typed code bases and I've worked in large strongly typed code bases. I have loathed every refactor I have had to do in dynamically typed languages. I just did a big one for a Python code base and I caught more issues and dependencies using grep and emacs than using the IDE and PyCharm. I have about 25 sizeable unit tests for this code base just to check flow control and dumb things like typos. I wouldn't need these unit tests in a compiled language.
JavaScript is the most popular language in the world. It's going to get a lot of hate and love. You contend that it gets disproportionate hate compared to Python and Ruby, but I disagree. I dislike all dynamically typed languages (save bash), and I think many people feel the same way. I honestly fail to see what they buy me.
If it's short and sweet I'll do it in bash, if it's any longer than what bash can handle I'll write the few extra lines of code in Go, for its safety and performance.
If I have to write browser code, I sigh and get on with my life.