Hacker News new | ask | show | jobs
by tferris 4865 days ago
- No proper packaging/namespacing

http://nodejs.org/api/modules.html

- Completely idiosyncratic results when operating with mixed data types (10 + 'p' = '10p', 7/0 = 'infinity' and all that)

I wouldn't call it idiosyncratic but just use Underscore and you are fine.

- Variables default to a pseudo-global scope

just use 'var' when declaring them

- Prototype based 'inheritance', while cool, is just cumbersome and inelegant compared to languages that have proper object oriented language constructs

Any OO is cumbersome and should be used only when it makes sense. If you don't like prototype based inheritance you can still use traditional OO with extra libs.

- Take all those and a syntax that was partially taken from Java, and you end up with verbose code jumble that is way more difficult to read than equivalent Python/Ruby (even C#)

Sorry to disagree again but there are many people preferring bracket based languages over those omitting them. You can quickly identify blocks and navigate through the source. And JS isn't verbose like Java.

JS has its quirks like any other languages but these are just very few and you get tons of amenities in return.

1 comments

I don't mind languages using brackets. I used to do a lot of C and C# development and it never bothered me. The problem is that, at least to me, a Javascript code base of around 2000 lines already becomes unreadable, specially when you consider some common patterns like 'declare a function to define a namespace'. You normally end up with functions inside of functions, calling jQuery event handlers by declaring yet another inline function... By the time you use a 'for' loop, you already are 4 indentation levels/brackets in. Messy.

As you say, libraries work around a lot of these problems, but most of these workarounds are hacks. 'require.js', for example. And you shouldn't need to use underscore to get sane typing. About OO... It's debatable, I think languages like CoffeeScript and TypeScript have done a good job of abstracting the weirdness, but that's the thing: they are languages that compile to Javascript.

Anyway, I like Javascript, don't get me wrong, it's just that I don't think it's a great choice for big codebases. I know I get a lot of hate every time I say this, but to me Node.js is an excellent example of using the right tool for the wrong job. Had the energy been put behind developing the same concept as a library to a language with a decent standard library, so much work would've been saved 'catching up'.