Live data from Hacker News

After a year of using Node.js in production

geekforbrains.com

11–20 of 248 posts

Re: After a year of using Node.js in production

#11
post #4

I train enterprise node.js for a living. My recommendation is to just use songbird (which exposes the forthcoming promise API from core, built on bluebird), async/await and the async `trycatch` library so you don't have to worry about a 3rd party package's choice of asynchrony. It also comes with optional long stack traces.

> Songbird mixes promise into Function.prototype

> Songbird adds promise to Object.prototype

Eek

Re: After a year of using Node.js in production

#12

These types of articles make me laugh. Typically a dev with many many years experience with one language, learned all it's quirks, standards, etc decides to try Node.js because it's the "new hot fun toy", and expect it to work like their old language, and realize that is not how it works, doesn't know where to find what and fails real hard to realize that JavaScript in general is in a huge influx of updating at this…

Yeah, so some js devs might need to stop overselling javascript to everyone, pretending it is the one language that people are waiting for years...Just saying.

Re: After a year of using Node.js in production

#13
post #3

> Coming from other languages such as Python, Ruby or PHP you’d expect throwing and catching errors, or even returning an error from a function would be a straightforward way of handling errors. Not so with Node. Instead, you get to pass your errors around in your callbacks (or promises) - thats right, no throwing of exceptions. Promises let you throw errors normally. They will propagate up the call stack in a simila…

I gave a talk about handling errors in Node a few years ago:

https://github.com/pjungwir/node-errors-talk

At the time the solution was "use domains", but I think domains are deprecated now. It was painful enough that I have stuck with Rails since then. I'm glad to hear that Promises are an improvement!

Re: After a year of using Node.js in production

#14
post #12

These types of articles make me laugh. Typically a dev with many many years experience with one language, learned all it's quirks, standards, etc decides to try Node.js because it's the "new hot fun toy", and expect it to work like their old language, and realize that is not how it works, doesn't know where to find what and fails real hard to realize that JavaScript in general is in a huge influx of updating at this…

Yeah, so some js devs might need to stop overselling javascript to everyone, pretending it is the one language that people are waiting for years...Just saying.

You should try to surround yourself with developers who don't have such attitudes. I am a fan of JavaScript, I love Node.js and I will often times suggest it to newbies. But I don't pretend it's the be all/end all of languages. Just like any other language it has its strengths and weaknesses. It's up to you to decide if it's the right choice for you.

Re: After a year of using Node.js in production

#16
Small company ops guy here - a bit over a year ago, I used to joke with my devs, asking them "So, what's this month's recommended way of installing node?". More recently we've been experiencing dependency hell, which is exacerbated by our small team not having enough time to upgrade to the latest LTS release. Node is definitely a language that you have to manage. It doesn't sit in the background and let you get on with writing stuff.

Is it the right tool for X or Y? I can't say, I'm not a dev. But it does require a lot of hand-holding and keeping current with the zeitgeist.

Re: After a year of using Node.js in production

#17

Thanks for this. The Node / Javascript ecosystem just seems like one I don't want to be a part of. I feel so lucky to have avoided the whole disgusting web stack.

Like the author said, Node isn't a great fit for certain apps. It sounds like yours is one of them.

Re: After a year of using Node.js in production

#18
post #5

I've spent a lot of time writing Javascript on the front-end in the last year using both React and React Native. I've found the React ecosystem to be a sane, productive and enjoyable development environment. Interested in sharing more model logic between our front- and backends, I also investigated writing some new backend features using Node (we're currently developing with Rails). But after days of research and pla…

The same problems you cite for node.js are the reasons why a lot of devs love node.js.

Its much easier to do your own research and find the best module to solve a particular problem you are having then to shoehorn into some larger monolithic framework.

Also its a lot more fundamental then that - Node.js has prolly the fastest iteration cycle for any platform out there since its so easy to create your own module - it leads to some sort of Cambrian explosion of innovation and experimentation.

EDIT:

Also OP seems to think callback hell and async programming is bad. The important thing is those things are problems for python/.... too !

Its just that python doesn't have a good programming model to even begin to address those concerns.

JavaScript at-least tries to say - "hey this is a problem we need to deal with - concurrency is a issues we all face "

So when devs complain about callback hell - its just that they have never tried to use python to do async in a neat way.

Re: After a year of using Node.js in production

#20
post #3

> Coming from other languages such as Python, Ruby or PHP you’d expect throwing and catching errors, or even returning an error from a function would be a straightforward way of handling errors. Not so with Node. Instead, you get to pass your errors around in your callbacks (or promises) - thats right, no throwing of exceptions. Promises let you throw errors normally. They will propagate up the call stack in a simila…

Kind of related: One thing that has bit me a few times with promises is accidentally missing a return in the promise body. As such whatever called the promise just sits there forever, waiting for something that will never come. Is there a way in Bluebird to have it throw an exception or similar if the function executes without returning anything?

I sort of don't understand your problem. If you forget to return a value won't the thing consuming the Promise just get undefined as the value (and perhaps throws an exception expecting the value to be something other than undefined)?
Post reply on HN