3 ms·
1. I think you're wrong. I would agree that JavaScript's syntax is not great, but it's still better than Java's. (And dynamic typing, whatever your complaints w
by samdk 15y ago
1. I think you're wrong. I would agree that JavaScript's syntax is not great, but it's still better than Java's. (And dynamic typing, whatever your complaints with it, does significantly reduce how verbose the language is.) Also, first-class functions are a huge benefit for me.
Also a lot of JS's syntactical issues/verbosity can be alleviated with libraries like Underscore. Start using CoffeeScript and you're miles ahead of Java in terms of syntax and verbosity, and you make some of JS's more annoying issues a lot easier to avoid.
2. Yes, you do care about performance, to a certain point. If everything I was doing had to immediately be available at Google scale, then yes, I'd consider Java a lot more seriously. However, most of the stuff I do doesn't have to scale to millions of simultaneous connections on just a handful of servers. Absolute performance is not my highest consideration, and NodeJS absolutely is more productive for me than Java.
I think you're missing a couple of very important points, which are why I think NodeJS is the best tool for some tasks.
First, and by far most importantly, it has Socket.IO, which is by far the best choice library when you're doing anything in real time. It is fantastic, and is a huge part of the reason why I use NodeJS for certain classes of applications.
Second, there is value to being able to share code between the server and the client for nontrivial web applications. Most code doesn't get shared, but not having to have separately maintained models for the server and client is really helpful.
For me, the 'cool factor' doesn't come into it at all. I enjoy programming in JS and even moreso in CoffeeScript. I dislike programming in Java. And when I'm not doing something that has to be hugely scalable, Java's only real advantage is raw speed, and NodeJS has vastly superior tools for doing what I'm trying to do (real-time webapps), NodeJS is the clear choice.
- zengr 15y agoOff topic: "Java's only real advantage is raw speed...". Tell this to some one 10yrs back and they would laugh. Java has come a long way. I think, using node.js or a Java stack is just a matter of personal choice.
- gkatsev 15y agoI think the main strength is the fact that you are writing JavaScript both on the client side and the server side. You don't have to mentally switch languages or anything. Even though people don't think that it has an effect, it does. And while, even in JS, you'll write things slightly differently when doing client/server side work but it still would take less brain power than changing client/server paradigms as well as changing languages.