Live data from Hacker News

Ask HN: Why Node.js and for which type of App?

news.ycombinator.com

31–40 of 49 posts

Re: Ask HN: Why Node.js and for which type of App?

#31
Reading all the comments here makes me wonder — Can Python (say, Flask) not be used for real-time communication (SocketIO, etc..) ? What is the difference between that and node.js ?

I am still figuring out a lot of things about Python, and this is something I found very intriguing. What would the differences between an IM app written in Python using Flask and it's nodeJS clone be, to a user?

Re: Ask HN: Why Node.js and for which type of App?

#32

Having used Node.js recently for a high volume service my feeling is it is best for lots of network communication.. but not long running or CPU/disk intensive operations. So, we're slowly transitioning to a Go backend with a slim Node.js layer to form the very friendly API while we use some RPC between the Node and Go. In this, Node.js is amazing and--I would guess--hard to beat. EDIT: Clarify with "CPU/disk intensiv…

I'm curious about why you say nodejs is not good for long running processes? I currently have a nodejs process running 24/7 pulling a MP3 broadcast stream and haven't had any real difficulties with it, outside anything I would expect with any other language. Granted, the process itself isn't doing anything extreme, just watching certain data in the stream. I'm just curious if there is something serious I haven't encountered yet.

Re: Ask HN: Why Node.js and for which type of App?

#33
post #26
post #11

Node.js is typically used for servicing web applications, but it has found some other surprising uses as well. There's a fairly sizable robotics (check out Johnny-Five) and drone community around it as well. The programming editor Atom by Github is also a "traditional" desktop app with Node.js at the core. In my opinion, Node's biggest advantage today is the absolutely massive module ecosystem that has sprung up arou…

> The programming editor Atom by Github is also a "traditional" desktop app with Node.js at the core. Nope, Atom it's based on electron[0] itself which use io.js and Chromium as a core. [0] https://github.com/atom/electron

It started using Node.js; it switched to io.js in February. I think for the purposes of "What's the use-case for node.js?" node.js and io.js should be considered the same.

Re: Ask HN: Why Node.js and for which type of App?

#34
Why learn Node.js:

The three most important reasons to use Node.js: it uses JavaScript which you might want to learn already, and second, it has a big ecosystem of modules and frameworks, including by companies like Microsoft and Google, and third, there is more JavaScript code on GitHub than any other language, if you're looking into contributing to open source projects or learning from them.

What you can do with Node.js:

JavaScript was already important as the language of the web browsers. As soon as JavaScript was split off from the web browsers thanks to the Node.js project, people have been writing web servers as well as command-line tools with it. It's also used to create interactive cross-platform native mobile apps and chrome/firefox extensions.

As a bonus, the asynchronous nature of JavaScript and its ubiquity in web browsers as well as web servers has lead to the creation of a wealth of official and unofficial standards and implementations of libraries for creating real-time chat and systems.

If you can do most everything in one language, why not?

Edit: someone already wrote a more technical overview, if you would like one:

https://news.ycombinator.com/item?id=9830207

Re: Ask HN: Why Node.js and for which type of App?

#35
post #34

Why learn Node.js: The three most important reasons to use Node.js: it uses JavaScript which you might want to learn already, and second, it has a big ecosystem of modules and frameworks, including by companies like Microsoft and Google, and third, there is more JavaScript code on GitHub than any other language, if you're looking into contributing to open source projects or learning from them. What you can do with No…

Don't forget non-blocking I/O.

Re: Ask HN: Why Node.js and for which type of App?

#36
post #35
post #34

Why learn Node.js: The three most important reasons to use Node.js: it uses JavaScript which you might want to learn already, and second, it has a big ecosystem of modules and frameworks, including by companies like Microsoft and Google, and third, there is more JavaScript code on GitHub than any other language, if you're looking into contributing to open source projects or learning from them. What you can do with No…

Don't forget non-blocking I/O.

Thanks, I updated the answer.

I left that out because some commenters mentioned that as the leading feature. But for somebody who's asking what Node.js is used for, I don't think being asynchronous is as important a reason as the fact you're writing JavaScript with great tooling, frameworks, and modules.

As far as coding day-to-day, there are other languages that have better semantics around writing asynchronous code. And it rarely makes a difference for first-time developers until they actually build something and try to scale, and at that point would need to read articles about doing that with Node.js just like they would with Ruby/Rails, Clojure, Go, etc.

Re: Ask HN: Why Node.js and for which type of App?

#37
post #18

I found Node.js to be quite difficult to work with, mostly due to nature of Javascript. Module ecosystem is vast, but each one has an API written in a different style. Combine that with no type-checking and lack of robust IDE auto-completion (Webstorm is quite disappointing at the moment) - and you get a frustrating experience. Oh, and also add asynchronicity into the mix. Making restful APIs is quite fun with it, th…

As mentioned, i tried Visual Studio Code on OSX. works like a charm.. i would give it a try!

Re: Ask HN: Why Node.js and for which type of App?

#38

Reading all the comments here makes me wonder — Can Python (say, Flask) not be used for real-time communication (SocketIO, etc..) ? What is the difference between that and node.js ? I am still figuring out a lot of things about Python, and this is something I found very intriguing. What would the differences between an IM app written in Python using Flask and it's nodeJS clone be, to a user?

good question!

Re: Ask HN: Why Node.js and for which type of App?

#39

Reading all the comments here makes me wonder — Can Python (say, Flask) not be used for real-time communication (SocketIO, etc..) ? What is the difference between that and node.js ? I am still figuring out a lot of things about Python, and this is something I found very intriguing. What would the differences between an IM app written in Python using Flask and it's nodeJS clone be, to a user?

[deleted]

Re: Ask HN: Why Node.js and for which type of App?

#40

Reading all the comments here makes me wonder — Can Python (say, Flask) not be used for real-time communication (SocketIO, etc..) ? What is the difference between that and node.js ? I am still figuring out a lot of things about Python, and this is something I found very intriguing. What would the differences between an IM app written in Python using Flask and it's nodeJS clone be, to a user?

It could be [1]. IMO, it sounds more like something slapped on top of Flask. You will find similar packages for Django, Pyramid and so on. Tornado feels natural in this sense as it aims to be asynchronous right off the bat.

See also, aiohttp [2] which seems very promising (Python 3.3+). As an aside, I've never seriously considered Python 3 till now after taking a look at aiohttp.

[1] https://flask-socketio.readthedocs.org/en/latest/ [2] http://aiohttp.readthedocs.org/en/stable/web.html

Post reply on HN