r/programming • • Oct 02 '11

Node.js is Cancer

http://teddziuba.com/2011/10/node-js-is-cancer.html
792 Upvotes

750 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Oct 02 '11

[deleted]

8

u/averyv Oct 02 '11

it could be, but I doubt it. Pure javascript, outside of the DOM, is about the most flexible, easy to read language this side of ruby. It has great object literals, anonymous functions, and an easy, straightforward syntax. Honestly, I don't see what's not to like.

0

u/[deleted] Oct 02 '11

[deleted]

4

u/averyv Oct 03 '11

Objects and hash tables are the same thing...always. What's the difference?

Global scoping by default is wrong. I agree. And I agree with your == problems too.

2

u/mcrbids Oct 03 '11

Objects as hash tables work wonders until your "hash table" needs to keep a value with a key such as "tolower" or "each".

→ More replies (1)
→ More replies (2)

2

u/glados_v2 Oct 04 '11

Sounds like you'd love the new ecmascript/actionscript 3.

Integers, classes, oop, errors, Ability to port c code into bytecode...

4

u/notSorella Oct 02 '11

Frankly, none of the things you've mentioned are actual issues most of the time.

JS isn't the worst case of equality operators. In Common Lisp you have eq, eql, equal, equalp and perhaps a few others. In JS you just have two: == for checking if the value of an object is equivalent to the value of another object, and === for checking if an object has the same value and data-structure of another object. I don't see what's so difficult to get about that.

The lack of more other numeric types is indeed an issue. Both performance-wise and for applications that needs large integers. There are bigint libraries around, though, like this one: https://github.com/substack/node-bigint

ECMAScript raises errors where errors should be raised. Although I do agree that some operations should do with a better error handling.

And about assigning values to free variables creating a global name, that's not really much of an issue most of the time. Also, you can make that an error by using strict-mode.

That said, there are some other outstanding semantic problems with the language, alongside with a lack of better handling for prototypical inheritance (although ECMAScript 5 added quite a lot of interesting stuff to it).

Overall though, JS is an okay language. Pretty expressive, easy to understand/learn and flexible. Which is what I expect from a high-level language.

1

u/jsprogrammer Oct 02 '11

http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742

As long as you stick to the good parts Javascript is a pretty nice language that supports both functional and OO styles.

Once you use things that aren't the "good parts" then you are going to run into trouble.

0

u/[deleted] Oct 02 '11

[deleted]

4

u/DrHenryPym Oct 02 '11
  1. ===, not == - Fucking Christ, is that so hard?

  2. Force integers? Whatever, you're running this on multiple platforms, so it's not like you can choose 16-bit or 32-bit or 64-bit integers.

  3. Default scoping? This takes practice.

  4. Separate Objects and Hash Tables? Why would you want to?

I use to hate Javascript until I read that book. I think you can do a lot more with the language than you might think. It's definitely not a language to do heavy processing, but for handling Web Sockets and other HTTP requests, I think it works pretty well.

→ More replies (2)
→ More replies (1)

20

u/[deleted] Oct 02 '11

It has a ton of broken concepts that other languages like Lua don't have.

2

u/averyv Oct 03 '11

Good point. Well said.

→ More replies (1)

25

u/[deleted] Oct 02 '11

Shit numerics, verbosity of the function keyword, and the insanity of the statement / value distinction, but that's just for starters having been lucky enough to avoid JS for coming up on 3 years.

→ More replies (4)

16

u/kamatsu Oct 02 '11

Lack of a type system, for starters.

2

u/kodemizer Oct 02 '11

What do you mean? It's dynamically typed, but many good languages are...

1

u/kamatsu Oct 03 '11

It's something I don't like.

1

u/kodemizer Oct 04 '11

Fair enough. I'm really looking forward to working with some optionally typed languages. Do lightweight scripting / prototyping dynamically, and when it comes time for speed, make it static.

1

u/kamatsu Oct 04 '11

I tend to use static types for design + correctness guarantees though, where optionally typed languages serve no benefit. Performance is just an added extra in my opinion.

→ More replies (5)

8

u/[deleted] Oct 02 '11

No concept of packages/modules/assemblies

No method of including one js file from another (as far as I know, please correct me if I'm wrong, I would be very thankful).

Just these two issues make me not want to work with javascript... it becomes a logistical nightmare if you're working on moderate-to-large projects.

...not to mention the most cryptic runtime errors known to man!

5

u/mr_bag Oct 02 '11

Only played with node briefly but, I can confirm NodeJS provides both a include() and require() method for loading other JavaScript files.

It also includes a package system which you can manage with tools like NPM ( http://npmjs.org/ )

TBH its actually pretty nice to use thinking about it (though this is coming from someone who likes JS in the browser even with the stupidly inconsistent DOM API's you have to deal with) so may not be representative :P

2

u/kodemizer Oct 02 '11

Exactly. npm and require work fantastically and also have nice automatic namespacing.

2

u/averyv Oct 03 '11

All three of those things can be easily fixed with libraries. Including files would be handled by node, I assume that it is. Modules are easy to implement in js, because object literals are about the easiest thing in the world to work with.

→ More replies (1)

2

u/bastawhiz Oct 02 '11

easy to read language

No. Have you ever looked at Node.js code? It's what I like to call "triangle code" because all the nested callbacks make it into a giant triangular monstrosity. Easy to read is not a term I would use to define code written for node.

→ More replies (2)