

Why JavaScript - dirkk0
https://nicolas.perriault.net/code/2013/why_javascript/
same here: loving python and forced into JS.
======
acjohnson55
The biggest problem with JS for me is not its quirks, but the way that until
you know--and I mean, really know--the language, you WILL make absolutely
horrific errors, on every single level of development. It does not matter how
good you are at writing C, Java, or Python.

Oh, what, you thought == was for comparison? Wrong. Oh, you didn't wrap your
all your code in an anonymous, self-calling function? You lose. Oh, what you
thought it was okay to leave off semicolons and var statements because they
aren't required? Sorry. Hmm, you didn't know how to manage dependencies
between scripts? Should have studied harder. You tried to iterate over an
array? Ridiculous. Your brain exploded when trying to write a series of
asynchronous functions in continuation style? A pity, really.

People who are good at JS like JS because it makes them special. They can lord
their knowledge of the quirks over "lesser" developers who come to JS
expecting it to act like a sane language. It took an entire industry about a
decade just to learn how to tame it. Sure, JS turned out to be really
extensible to new paradigms, but hey, so is the lambda calculus.

A good language makes good programming look natural. Like Python. JS is the
opposite.

~~~
davedx
The worst one for me with JavaScript lately is trying to build some form of
object orientation into my code. There's no canonical way to even implement a
constructor, for christ's sake. I haven't even dared to touch trying to use it
for polymorphism. Or composition, for that matter. I'm staying the hell away
from it for anything simpler than UI code.

If JavaScript was a nicer language I would be spending more time in Node.JS,
but it's not, so I'm sticking with Rails.

~~~
ufo
I actually don't mind this problem much, although that might be my "functional
programming" bias.

You only _really_ need a "canonical" way to do things if you will be wanting
to use features that depend on your classes being implemented in a predictable
way. For example, class inheritance or implementing "super" method
functionality.

> I haven't even dared to touch trying to use it for polymorphism.

Its not at hard as it sounds, since you have first class functions and
closures. You can often handle functions directly instead of needing to create
objects for everything.

------
lucian1900
That doesn't change the fact that it has more flaws and idiosyncrasies than
most other languages.

We use it because we must, not because we choose to.

~~~
user24
Where I work, we chose it. Could have carried on using PHP, could have moved
to $otherLanguage. We chose NodeJS.

~~~
lucian1900
When the alternative is something as stupid as PHP, sure. But there are much
better languages out there that would entirely eclipse JavaScript, if it
wasn't the only thing that can reasonably be used in browser.

~~~
chris_wot
And yet, nodejs is a perfectly reasonable choice for web development for many.

~~~
user24
Exactly. The claim was "We use it because we must, not because we choose to."
This is not true because even in environments where we need not, some of us
still choose JS.

------
jiggy2011
The biggest problem I have with JS is the multitude of libraries you need in
order to make it usable.

These libraries all seem to use and encourage different patterns and trying to
use 2 together often leads to confusion.

Switching to a project that uses something different, say prototype instead of
jQuery feels like learning from scratch again.

~~~
davedx
To be fair, I've found many, many projects use underscore for their go-to
'utility' library and it's pretty decent and readable. What other libraries
have you seen as dependencies that cause clashes?

~~~
jiggy2011
Not so much clashes, just documentation and examples tend to use often
radically different coding styles.

------
shawndrost
Devs: you should make JS your primary language. It's a complete wild west
right now -- still lacking so much as a package manager for the browser -- but
meanwhile, the entire internet is moving into a rich client architecture.
Tools like Backbone, while useful, are very clearly not the platform we'll be
using in a few years. It's a phenomenal opportunity to do meaningful work and
be in very high demand.

Self promotion: I believe the above so firmly I went out and started a school
for JS devs, Hack Reactor (formerly Catalyst). <http://hackreactor.com>

~~~
dirkk0
I totally agree with you except that I still stay with the combination Python
and JS (actually like the author). But there's no way to avoid JS so why not
better embrace it.

@hackreactor: nice! @packagemanager Yeoman (<http://yeoman.io/>) does
something like this and a couple of other solutions, too.

------
DanWaterworth
_There are only two kinds of programming languages: those people always bitch
about and those nobody uses. - Bjarne Stroustrup_

On the other hand, this was said by the creator of C++ and correlation doesn't
imply causality; maybe some of the factors that contribute to a language
becoming mainstream also cause irritation.

~~~
dysoco
It's funny because C++ is used a lot and everyone bitches about it.

------
blablabla123
Great post, it's just annoying to hear people ranting about JS over and over
again. The most annoying fact is, most of these people don't know how to write
anything useful in JS besides copy&pasting a few lines a jQuery code. (I have
doubts whether it's possible with this knowledge to understand how modern
webapps are working.)

In the recent time I've often read posts about people suggesting: learn
language X to a reasonable proficiency before you criticize.

~~~
PommeDeTerre
In my experience, those who criticize JavaScript the most have often used it
for many years, and know it extremely well.

These people also usually have many years of experience with other, far more
sensible programming languages, too. I'm not talking about PHP or Ruby,
either. Rather, these people know one or more of languages like C, C++,
Objective-C, Java, C#, Haskell, Erlang, OCaml, Standard ML or Python inside
and out.

With such knowledge, it becomes very obvious just how bad JavaScript is. The
utter stupidity of many of its flaws becomes so apparent. These people also
can see how it lacks the language features necessary for large-scale, multi-
developer, distributed development, and then the subsequent maintenance of
such projects. They've felt the pain of its numerous other problems time and
time again.

I'd say the reality is much the opposite to what you describe. The ones who
advocate JavaScript most often have never used anything else. They don't
realize how many of JavaScript's inherent problems, or "quirks" as they like
to call them, just don't exist in most other programming languages. If they
have used another language, it's usually PHP, which is arguably worse than
JavaScript in many ways. While living in this bubble of ignorance, they don't
see JavaScript's flaws for what they truly are.

~~~
chris_wot
I notice you said all that without explicitly naming a single flaw.

~~~
PommeDeTerre
Are JavaScript's many flaws truly not glaringly obvious to you?

~~~
chris_wot
No.

~~~
PommeDeTerre
I'm truly sorry to hear that. Have you ever used any other programming
language?

------
lampe
I think the biggest problem is that there are many many bad tutorials/book
about javascript and only a few good once.

Often people wane code javascript like language X but javascript isen't
language X! You must learn it like every other language! But if often see
people doing javascript "when they need it". Nobody writes C just cause they
need it... Normally people just sit down and read a book about C.

~~~
PommeDeTerre
The "best" JavaScript-related book, as chosen by the community at large, is
generally considered to be "JavaScript: The Good Parts", by Crockford.

While the most widely respected books for other programming languages teach
one how to use such languages' features effectively, "JavaScript: The Good
Parts" basically says not to use large parts of JavaScript.

That alone should show just how poor of a language it is. You don't have to
ignore, or actively not use, so much core functionality when using a good
programming language.

~~~
dirkk0
Also there is this resource, and the first sentence says it all:
<http://bonsaiden.github.com/JavaScript-Garden/>

------
mhd
This sounds awfully familiar, if you replace JavaScript with Fortran and Web
with number crunching. And I didn't buy it back then.

------
mnarayan01
The reason people use JavaScript for scripting in the browser is because there
is no other option. The biggest reason I see to use it outside the browser is
because you're already using it inside the browser. There are plenty of things
to dislike about JS, but the ability to use it both in and out of the browser
is a pretty big upside.

------
dschiptsov
Nothing is deeply wrong with it as long as it stays inside a browser.)

~~~
madoublet
Too late.

------
sramsay
"The first time, to hate it. The second time, to start appreciating it. The
third time, to understand it and get shit actually done."

Not unlike the process of becoming addicted to heroin.

