It took more than a year to use Node. js, and now it's already the brain of Node. js. This log is rather complicated, which is a concentrated discussion of all aspects of Node. js. The first is performance. It seems that the performance of Node. js is not as good as you think. Memory usage is similar to Ruby, which is more than Python and PHP. In terms of computing performance (that is, CPU usage), pure computing does not have much advantage, but because it can control asynchronous processes well, the overall performance is much better than PHP. I personally think Node. js has great potential in terms of performance, because many large projects are dedicated to improving the performance of JavaScript virtual machines, such as various browsers. At the same time, JavaScript is a simple syntax language, it is also an open standard. Unlike Python and PHP, it is difficult to perform large refactoring to improve performance because of compatibility.
Then the Package Manager and library, Node. js has built-in npm, because npm is a very easy-to-use Package Manager, because JavaScript has a low writing threshold, because many excellent front-end libraries have been transplanted to the backend, therefore, NPM has more packages than PyPI and RubyGems, and far exceeds PEAR and Composer. node. in js development, the difference from PHP is that everyone is not afraid to add dependencies, and every small requirement is to find the existing library on NPM for implementation-and often can be found. Therefore, the development of Node. js is basically in the combination of dependencies, and then tends to write a library even if a small independent requirement, which is similar to the UNIX idea. On the other hand, Node. the js community is very friendly to open source. The friendliness here refers to that most libraries are open for development on Github and use very loose protocols, such as MIT, unlike GPL 」.
Community, Node. most of js applications are Web backend, while the Web backend-related libraries are basically made up by a few experts, such as express, jshttp, jade, mocha and koa are developed by four or five people headed by corner stone. This is an interesting phenomenon. -- Although the TJ gods finally decided to fade out of the Node. js community.
Tool chain, Node. javascript is relatively young. Many useful tools have just emerged in the past two years, such as pre-compiled dialects, unit tests, simulated tests, and build tools. I dare not say how good they are, but it is much better than PHP. As for the reason, the first major reason is that these libraries are applicable to both the front-end and the back-end, because of the hard demand of the Web Front-end, let Node. js benefits by the way. Then, thanks to the flexible and simple Syntax of JavaScript, these tools can be implemented in some clever and elegant ways. As for the IDE, it still benefits from the Web Front-end, and there are still some available IDES-although the JavaScript language itself is not very conducive to static analysis.
I would like to emphasize the simplicity and flexibility of the JavaScript syntax. The important point is JSON, which is almost the most common data format in the Web field, javaScript has native support for JSON! All the data structures in JavaScript are centered around a JSON superset-Object, including arrays, functions, objects, and classes. Of course, this also brings about a problem because there are few write restrictions, and you don't know how to write them. At the beginning of learning, You can't re-engineer them repeatedly, in order to find out the advantages and disadvantages of various design modes under different circumstances, find the appropriate method for yourself and the specific project, so you can say Node. js is easy to get started, but it is still a test of developers' skill to build large projects. Due to historical issues, the JavaScript syntax is not very elegant, but fortunately we have a variety of pre-compiled dialects, such as Coffee Script, TypeScript, Dart, LiveScript, and ClojureScript, there is always a suitable one for you.
In use cases, JavaScript is a common programming language. You don't have to say it before and after the Web. Let's look at other aspects. I personally think Node. js is very suitable for writing server tools, or O & M tools. It can work asynchronously in many O & M scenarios, and JavaScript has good Regular Expression support, replacing bash and Python is not a problem. Node. javascript can be used as needed by installing an interpreter without the hassle of introducing dependencies. While desktop and mobile device programming, Node. js has node-webkit and various other shells. Although the current user experience is not good, it can significantly reduce development costs and easily cross-platform. The future is bright.
Finally, learn Node. js, in my opinion, learning Node. js is divided into two points. The first is to clarify the Node. js's "Asynchronous IO Based on Event Callback", which is Node. js is the most different from other mainstream programming languages. The second step is to take a look at all the Top 100 databases on NPM. You don't need to take a look at them. You just need to mix your faces and know what each database is doing. Congratulations, you are already a Node. js developer.