1

There are a few claimed benefits to Node.js that I typically hear. Some (many?) I agree with. There is one that I completely do not understand, which is the one language argument: "You can now use one language on both the client side and the server side."

This does not make sense to me on many levels:

  1. most people already know more than one language, and learning a second is anyway not that big of a deal.
  2. JavaScript is not that great of a language; if people had any choice they'd probably choose something else on the client side, but they're locked in.
  3. the beauty of the server side is you can choose ANY language (so it makes sense to choose the best, most capable language, with the least baggage).

The only reasonable argument I've heard is "if I'm using backbone I can re-use my models". Since I haven't used backbone myself I'm not sure how much that actually amounts too however.

Can someone shed some light?

11
  • 1
    Lots of assumptions in this question. First, while learning a second (or third or fourth) language is not that big a deal, you can't assume everyone has the time, energy, skills or interest to do so. Second, your opinion of Javascript is just that: your opinion. Some people may share that opinion, but you can't assume everyone does. Or even that most do. A lot of extremely smart and capable people stick with Javascript, I don't think they would if they didn't enjoy working with the language.
    – yannis
    May 14, 2013 at 4:25
  • 5
    @YannisRizos: A lot of extremely smart and capable people stick with Javascript, I don't think they would if they didn't enjoy working with the language. You see, though, that's the beauty of monopolies. A statement like yours is only valid if they have a choice, but on the browser-side scripting front, JS is the only game in town. May 14, 2013 at 4:32
  • 1
    @MasonWheeler True, but JS is not a monopoly on the server side. Fact that node.js even exists is a very good hint that at least a handful of extremely smart and capable people chose to work with JS in the server side.
    – yannis
    May 14, 2013 at 4:51
  • 3
    I don't think it's a stretch to say that javascript, the language, has problems. I mean, the most popular book is called "the good parts" and basically outlines a long list of gotchas. Even the "good parts" are full of gotchas. When I read that book, I was reminded of c++, and not in a good way.
    – Kevin
    May 14, 2013 at 4:53
  • 4
    Every language has problems. And many of the problems are more matters of personal preference than actual problems. Working with the same language on both the client and server side may be a benefit to some people, and a complete disaster to others. If it's not something you see as a benefit, great, there is a ton of other options for you.
    – yannis
    May 14, 2013 at 5:04

2 Answers 2

4

Let's start with your points:

  1. Most people don't want to work in several languages in the same day.

  2. Javascript works. It may not be the pinnacle of language design, but it is incredibly flexible. The perceived quality of the language rests a lot on the programmer, which is pretty unique.

    • There are some bad parts, but every language has those
    • The bad parts are very well documented and can be easily avoided
    • It's actually quite fun to write in. I can't say that for any OO language.
  3. Some people choose Javascript for the server, and Node.js's popularity highlights that. In fact, a lot of the Node.js community came from Ruby, which is considered a very fun language to write in.

Now for my points:

  • Fantastic community with incredible energy
  • Massive portability (includes code reuse)
  • Decent package manager

I find Javascript a fun language to write in. When I'm working in other languages, I often miss features that they done have, such as first-order functions, Array methods, stupid-simple closures, and prototypal inheritance (it's fun when you get to know it).

Javascript is not my favorite language, but it's definitely not the worst. I've since left the Node.js bandwagon, but I still keep it in my toolbox. It's a lot more interesting than languages like Java or C++.

8
  • 2
    "There are some bad parts, but every language has those." - the ratio per language differs though.
    – Den
    May 14, 2013 at 8:44
  • 1
    "It's actually quite fun to write in." -- maybe so. Not much fun to read or debug though.
    – funkybro
    May 14, 2013 at 10:20
  • 1
    @funkybro that's your opinion and yours only. I have no issue reading and debugging js code every day. Now, if you're talking about badly written code, then it can be told for any language. May 14, 2013 at 12:31
  • 1
    @FlorianMargaine "It's actually quite fun to write in" is his opinion! It's all just opinions.
    – funkybro
    May 14, 2013 at 12:49
  • @funkybro - Just going out on a limb and guessing you're my downvote. This question is highly subjective, so it's impossible to give an non-subjective answer. There are debugging tools (node-inspector being the most popular). It's inherently difficult to debug async programs, but that's not specific to JS, it's true of any concurrent language (Erlang, Go, threaded C/C++/Java, etc.). Care to elaborate?
    – beatgammit
    May 14, 2013 at 15:52
1

"You can now use one language on both the client side and the server side" doesn't require that said language be JavaScript. There are a number of other languages which can be compiled into JavaScript, avoiding some of its pitfalls. Some are designed specifically for the purpose (e.g. CoffeeScript), and others have a large pool of experienced programmers (e.g. Java).

On the one hand it might seem crazy to compile Java to JavaScript and run it with Node instead of compiling it to a war and using a J2EE application server. On the other hand, compiling whichever source language you use to JS for both the client and the server avoids issues which could potentially arise due to translation gotchas.

3

Not the answer you're looking for? Browse other questions tagged or ask your own question.