Hacker News new | ask | show | jobs
by throw51319 2061 days ago
I don't get Node JS. It seems like you just need to somehow know the function for a specific version of it, and stuff changes all the time. And there's not really a good auto-suggestion.

You need to know the args, and it just seems "hacky". Like it's good to write something small when you know what functions you use etc... but just not stable for big stuff.

5 comments

I can’t really agree with this, especially not since the advent of typescript. There’s not a dynamic language in existence with better tooling than JavaScript. You open up a js file in vscode or webstorm or whatever, and the typescript language server kicks in so you get type hints for all your code. If you switch to typescript it’s a whole other level of type safety.

Also, it seems like your comment could be generalized to include all dynamic language runtimes, not just Nodejs.

Yeah i guess. I don't really know that much about it anyway. I like Java, the IDE is so rich for it. Just makes writing so easy.
Node.js still implements CommonJS callback-style APIs (for web, file i/o etc) and module loading, specified in 2009 or so. "Stuff changing all the time" really isn't doing justice to Node.js. IMO, the Node.js API turned out to be very much on the stable side of things, yet also sports eg upcoming QUIC support
That's not even remotely true. Node's core library stability is exemplary - it is near-impossible to make breaking changes to it, even across many major versions.

You can set up most IDEs to get excellent auto completion - VS Code does a good job of that kind of thing.

That's more of a JS issue than Node issue. The problem you are describing is one of 10 years ago, but not so much today, so long as you have a decent IDE. Intellij is the best IDE out there for autocompletion/intellisense of JS.
> And there's not really a good auto-suggestion. You need to know the args

IDEs do spoil people.

I can't write dynamic languages because of this. I would often not know what type a function expects or returns if it wasn't for compile time suggestions (which in turns allows language servers).

Makes scripting languages really hard for me to use as a consequence.

I think this is one of the main reasons why TypeScript got so popular, the other reason being the excellent support for it in Visual Studio Code. Before adopting TypeScript, I'd have to read documentation in a wide variety of documentation styles and standards, and then manually ensure that I was calling the right functions with the right arguments (or - alternatively, if I was lazy - I'd just write some shim code and attach a debugger to figure out the call signatures of callback functions). With TypeScript and type hints installed for the libraries I'm using, instead I just let my editor hand out typing information and autocomplete hits, and let the typescript compiler do type checking.

If anything, TypeScript sometimes feels like a nice middle-ground between C# and JavaScript (and Java?), and though it's not perfect, I do feel that it's pleasurable once you get the hang of it and the quirks of the ecosystem.