I can't imagine choosing to write Javascript on the server, but considering its popularity I'm wondering if I'm wrong. So I'm curious as to the reasons people chose Node.js and whether you would recommend it, anybody willing to share their experiences?
NodeJS has a handful of things that tend to get brought up. Callback soup and difficult error handling. Both are resolved by promises. Once you get the hang of promises, you are capable of doing concurrent asynchronous tasks in a manner that would be significantly more difficult in any other language. On top of that, NodeJS is very, very fast. Compared to Python or Ruby, straight computing is significantly faster, bu…
Hard-won lessons: Five years with Node.js
111–120 of 365 posts
Re: Hard-won lessons: Five years with Node.js
#112I can't imagine choosing to write Javascript on the server, but considering its popularity I'm wondering if I'm wrong. So I'm curious as to the reasons people chose Node.js and whether you would recommend it, anybody willing to share their experiences?
I think places like HN are probably distorting your view of how popular it is.
Re: Hard-won lessons: Five years with Node.js
#113Reading up on all these Node.JS posts I'm surprised at just how many gotchas the platform has and how there's no single standardized way to solve them. It's not encouraging stuff. On paper the platform looks decent but aside from a few use cases it seems that there's more hype than it merits.
https://github.com/npm/npm/issues/10999
https://github.com/npm/npm/issues/9633
I have personally hit both while trying to build (not even write!) Node software.
The former bug is an example of "broken by design", and it's interesting that it remains open (therefore admitting that it is a problem?), but no solution came yet. Although I believe Yarn doesn't have it - but then why doesn't the entire Node community move to Yarn?
The latter bug is, to me, just insane. Several dozen bug reports (and even more if you google for the error message); and when it shows up, it can be an outright blocker. It was for me - I plainly couldn't build the software that I wanted, and no workarounds helped. And no fix, 1.5 years later and counting.
Re: Hard-won lessons: Five years with Node.js
#114Earlier quoted context omitted.
That's not Node.js. That's Express or a similar abstraction. You can execute everything inside a promise like with Koa, which amounts to something like: http.createServer((req, res) => { handle(req) .then((response) => res.send(response)) .catch(() => res.send(500)) }) Where `handle` is an async function and thus all your application logic is in async/await space.
It's Node.js - the root of the problem is also Node's strength, which is that there's effectively no stack. You can manage zillions of concurrent connections, but there's no easy way for the system to unwind bad behavior by one of those connections. In a Java app you except all the way to the request response. In a Go app you return all the way to the request response. In a Node app, you have to call your way back to…
Re: Hard-won lessons: Five years with Node.js
#115Too many lessons learned and arbitrary rules to follow equals flaws with design/language design
What language does not have these kinds of problems? I have encountered them with every programming language.
Re: Hard-won lessons: Five years with Node.js
#116Can someone recommend a Nodejs performance monitoring solution that works great?
Re: Hard-won lessons: Five years with Node.js
#117The biggest hard lessons I've had with Node.js have been around handling errors - when I first deployed https://www.findlectures.com , I was shocked to realize that uncaught errors could take down the whole site. Not handling error callbacks is also a big problem - TypeScript has been an awesome solution though, because it can show compilation errors if you screw up function arguments.
Re: Hard-won lessons: Five years with Node.js
#118Earlier quoted context omitted.
Unfortunately I do not yet know very much about Rust, but I wasn't referring to the specifics, but to the point that every programming language seems to have quirks and hidden rules.
So just use a programming language with less annoying quirks and hidden rules. Especially when those quirks are issues at compile time, not issues at 3 AM in production. "And I found a whole lot of references to req.randomThing and even some req.randomFunction() calls. I then proceeded to search back through every single middleware function which had run before, to figure out what exactly was going on." In a statical…
Re: Hard-won lessons: Five years with Node.js
#119I can't imagine choosing to write Javascript on the server, but considering its popularity I'm wondering if I'm wrong. So I'm curious as to the reasons people chose Node.js and whether you would recommend it, anybody willing to share their experiences?
So I felt this way until about...oh...a month ago. Because my JavaScript experience was mostly ES5. And ES5 is a roiling piece of shit that I wouldn't wish on my worst enemy. ES6, however? ES6 is tolerable. Getting it set up isn't as bad as you'd think and the language does as much as a Ruby or a Python in not shooting yourself in the foot. I'd trade async/await for actual threads, because I am capable of writing cod…
Between ES6 fixing [0] many of the day-to-day warts that made JavaScript a joke language barely suitable for scripting DOM elements and V8's complete obliteration of other dynamic VMs in speed, I am being forced to accept that JavaScript is maturing into a serious platform, and starting to gradually introduce Node.js into my workflow.
Just today I was discussing how hard it is to pull the stick out of my butt regarding JavaScript, but I think that the evidence is in favor of it. I'm having a strong impulse to try to use Dart instead just so I don't feel as dirty anymore.
Re: Hard-won lessons: Five years with Node.js
#120Earlier quoted context omitted.
So just use a programming language with less annoying quirks and hidden rules. Especially when those quirks are issues at compile time, not issues at 3 AM in production. "And I found a whole lot of references to req.randomThing and even some req.randomFunction() calls. I then proceeded to search back through every single middleware function which had run before, to figure out what exactly was going on." In a statical…
"I wasn't referring to the specifics, but to the point that every programming language seems to have quirks and hidden rules."
Which is true, but ultimately useless