

Ask HN: Why are we obsessed with javascript? - personjerry

Everyday I see Yet Another Javascript Framework or another product built in Javascript.<p>For example, Angular.js, Meteor.js, Backbone.js, Ember.js; Github&#x27;s Atom editor, the new Breach browser.<p>What makes Javascript so wildly popular?
======
bphogan
I think one reason is that lots of people know it. And if you already know
something, you don't have to learn something new.

Sometimes that's bad. For example, someone trying to make a super performant
iOS app who only knows JS and refuses to learn Objective-C and C++.

Sometimes it's fine, like a web developer who needs to deliver a business app
on all the mobile devices.

I think the fascination with JavaScript is interesting, personally. I don't
enjoy the language, but I can't deny that it's easy to pick up for beginners.
It has a low barrier to entry, and can, in some cases, encourage people to
learn to make things on the computer.

I do find quite a few folks who refuse to look past JS or Node. Honestly,
using JS on the server side makes no sense to me, given that Go or Erlang can
do concurrent backends better, and other tech can do regular web backends
better.

But still, the fact that _good_ JavaScript programmers can bring there talents
to the backend does have merit.

We're software developers, charged with solving problems in exchange for
money. The tool that does that in the most effective and efficient way is the
right tool, right?

~~~
PhrosTT
I would dispute that it's easy to pick up for beginners. It's easy to START
doing then things, and then intricacies you don't understand will kill you.
The prototype chain, function call context, closures, asynchronous code, etc.

Type _class Dog extends Animal_ into js2coffee.org and you get this:

    
    
        var Dog,
        __hasProp = {}.hasOwnProperty,
        __extends = function(child, parent) { 
          for (var key in parent) { 
            if (__hasProp.call(parent, key)) child[key] = parent[key]; 
          } 
          function ctor() { 
            this.constructor = child; 
          } 
          ctor.prototype = parent.prototype; 
          child.prototype = new ctor(); 
          child.__super__ = parent.prototype; 
          return child; 
      };
    
      Dog = (function(_super) {
        __extends(Dog, _super);
    
        function Dog() {
          return Dog.__super__.constructor.apply(this, arguments);
        }
    
        return Dog;
    
      })(Animal);

~~~
bphogan
First, I'd argue that none of that would be "beginner" things.

Programmers always seem to forget what it is like to not know how to program.
A beginner would never use something like that.

Second, when you bring class-oriented Java-style constructs to JavaScript, it
looks ugly because it's not what JavaScript is about. JavaScript is different.
It's got a completely different way to do OOP, which you have to learn.

I'll agree that JS has weirdness. But a lot of the things we think are "wierd"
are things that seem strange because we've programmed in Java or something
else.

Ask someone who started with JS and only learned JS. They don't find those
things strange at all.

------
kingdomking
I wish it was something about Javascript itself that made it so wildly
popular, based on some inherent property that we as a community recognized,
isolated,and grew from but unfortunately like many of us have already stated,
it's not, it's a people problem. Does anyone see a correlation between a
programming community's activity and the perceived controversy of that
community? I hope you do because it's a natural development of a large and
growing group of people interacting with one another. You'll see it here on
the web with large communities, you'll see it at work on some layer of
business, and you'll see it outside of your homes. It's not the Javascipt
communities size but the amount of people in this field as a whole. As long as
you understand building abstractions is our job and leaky abstractions are our
job security, you should understand the motivation. Because of it's ability to
not only encourage but demand both in short succession, Javascript being the
assembly language of the web is big business, a lucrative ecosystem of those
building things and those fixing what's broken in a race against... oh yeah,
what are we doing this for again?

I can see why industry sold this idea to the general populace, it's economics
pure and simple, but the programming community has inadvertently been
influenced(bought) by it too. Those ideas are only appropriate for business
and barely at that if if you believe in business integrity. This is not
appropriate for a community that expects to learn, teach, grow, and influence.
We already know what those things that encourage real community and I have
this feeling people know where I'm coming from so I hope there's a way we can
set things straight again.

I've only been programming for a year now lol so I'm still wrapping my head
around this all.. I'm starting to see leaky abstractions everywhere :X but the
biggest one of all is us.

------
robotcookies
"Write once, run anywhere". This is partly, I think, the same reason why Java
skyrocketed to popularity in the mid 90's. It gave hope of transcending the
boundaries of the operating system.

Java, of course, failed in delivering on this promise. However, nothing has
come as close to delivering this as Javascript has. Write once and your code
will work on a mac, windows, linux, iPhone, android, and on.

~~~
jayvanguard
Java succeeded with this on the server-side but failed on the browser and
desktop side. I'm not sure how to characterize it on the mobile side --
success in core libraries and basic language but not in the UI.

Javascript has finally gotten reasonable on the browser and ok on the server,
but mobile Javascript apps aren't much better than Java was/is on the desktop.

~~~
peterashford
Java succeeded with "run everywhere" on the desktop. A java binary written on
a Mac will work in Windows or Linux.

But yeah, Java as a desktop development language per se has had mixed success.
Minecraft did okay :o)

------
TheSageMage
Do you do any type of web development? You don't really have any choice if you
do. You can do a lot of things server side, but once the code has left your
server, your technology is limited to what the users browser supports.

All browsers I know of support JS(EMACScript), HTML, CSS. They may support
other things, but often not all of them do. Javascript itself is a very basic
language, and a lot of the build in methods are either not intuitive or are
complex in its access and you have know the nuances of the language to work
with it.

These frameworks often provide more intuitive access to JS by applying
patterns such as MVC on top of JS. You could do this yourself in JS, but why?

I will give your question credit that it does seem like there are a TON of
libraries for Javascript and it seems like every day there is a new library
promising something in Javascript.

TL;DR: Javascript is the only widely-supported way of coding in a browser.

~~~
unfunco
*ECMAScript. Thankfully nothing to do with Emacs.

------
peterashford
Seriously? JS is crap but it's the only option for running stuff on the client
on the web. When you're literally the only game in town you don't need to be
good. And because it isn't good, people spend a lot of time trying to layer
stuff on top of it to make it less obnoxious.

~~~
yen223
Bingo. It's all about network effects. No other language can overcome
Javascript's dominance in the browser ...for now.

------
roasm
It's the ubiquity of the interpreter (every browser), right? You'd be hard-
pressed to write anything for the web without JS, and once you're writing in
that language, there's a strong pull to use similar libraries/processes/etc.
for non-in-browser work.

~~~
x1798DE
It's not at all hard to write things for the web without JS, it's just if you
need an application to be client-side for whatever reason, JS is necessary. I
would guess that most sites over-use Javascript (or, at least, are overly
reliant upon it).

------
chton
I've been wondering the same thing. One of the contributing factors is
definitely that everybody already knows it. We've been forced by years of web
development to have an understanding of it, so being able to reuse that
knowledge in a non-web context makes it interesting.

Additionally, it's virgin ground. Most languages you'd use to build an
application in (like java, C++, C#, etc.) have become quite bloated with huge
default frameworks that everybody uses. Using JS for anything more advanced
than a web page is relatively new, so there is a lot left there to discover
and do your own way.

------
alttab
>> What makes Javascript so wildly popular?

Circlejerks.

In all honesty though, I haven't seen anything truly revolutionary outside of
the work done on the client (jQuery, Bootstrap, AngularJS).

Every other framework is re-inventing a shittier wheel. IMO, YMMV, get-off-my-
lawn.

------
richbradshaw
Make anything that's viewed in a web browser? You have exactly 1 language
choice - Javascript. That means that everyone who makes websites needs to use
it.

We aren't obsessed with it any more than iOS developers are obsessed with
Obj-C.

------
poseid
JavaScript is the language of web browsers. And, the web browser is one of the
most used software on the planet.

Write a cool web browser that runs MRuby, Lua, or anything else, and maybe you
can reverse this?

------
Someone1234
It runs everywhere. No other programming language can claim the same,
particularly on mobile devices. Hell I can run JS on my fridge(!).

~~~
abledon
What fridge model? I may buy a new one soon.

~~~
Someone1234
It is a Samsung WiFi enabled smart fridge. I don't know the model off hand.

------
lucasnemeth
it runs on the browser.

~~~
personjerry
That doesn't explain why apps like Atom are written in JS

