Node. js is not a silver bullet, but it is still a bullet.

Source: Internet
Author: User

Craig, author of this article, is a free software developer living in New York. He recently saw the article "if you are using Node. js, you are the author of "go astray", the article on Node. craig expressed dissatisfaction with the accusation in js, so he wrote the following article:

I really don't know why some people hate Node. js like this. You have also seen a lot of articles and high-profile comments about Node. js on the Internet, as if Node. js is a good solution to all problems. No. Just like many other existing frameworks and languages, it performs very well in some things, but it does very poorly in other things.

In my understanding, Node. js is designed to transmit a small amount of bytes of information quickly and in real time over the network. Server-side event processing, instant messaging applications, real-time games, and collaboration tools are all good examples. Use Trello as an example. Trello is a real-time collaborative application that uses Socket. io and Node. js to implement real-time event propagation and state transformation between clients. You can use frequent queries or ajax long-term queries to accomplish the same thing, but these two methods occupy unnecessary worker threads on the server side and need to process additional requests. In a certain aspect, Node. js is essentially good at such things. Its asynchronous event processing-based architecture makes receiving, processing, and sending real-time event messages easy and fast.

At the same time, Node. js is not very good at computing. For example, if you want to create an API that can return the nth number in the Fibonacci sequence, using Node. js is not a good choice. Why? All the reason is that Node. js is used to avoid waiting for anything. Compared to waiting for a database to return the query result, Node. js triggers a query action and sets a callback event. In this way, when the query is executed, your program can do other things (such as processing other requests ). This makes Node. js look very fast and generally does not require multiple CPUs. However, in our example of calculating the Fibonacci series, the program does not need to wait for anything. The speed at which this API returns results is directly dependent on the computing speed. Therefore, it is more appropriate to use another language with higher computing power, such as Haskell or Scala.

What do all these points mean? The point is, if A framework is designed to solve task A, but you complain that it cannot complete Task B Well, this is silly and absurd. Node. js performs exceptionally well on the things it is designed to do-so don't yell at it for not being good at other things.

Original article: http://www.aqee.net/node-js-isnt-a-silver-bullet-but-its-still-a-bullet/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.