Blanche
Engineer
Engineer
  • UID619
  • Fans3
  • Follows2
  • Posts59
Reads:64145Replies:10

Node.js vs Java

Created#
More Posted time:Sep 2, 2016 9:37 AM
Preface:
More and more colleagues are talking about Node.js, about its asynchronous IO, event callback and uniform language for both foreground and background development. For entrepreneurs, you may have chosen Node.js for your first project as you desire to complete development in one language to save time and costs. But I was “ridiculed” when suggesting Java as the project architecture to colleagues from other project groups. They thought I was outdated by still sticking to Java. I also found that more and more front-end colleagues are tapping into back-end function development using Node.js. As a background development engineer, I feel the stress.
So leveraging the opportunity of the new project, I systematically studied the knowledge system of Node.js. This article summarizes the Node.js technologies I learnt and compares counterpart technologies of Java, in an aim to provide some decision-making reference for architects evaluating the two types of architecture. To avoid disputes, this article does not make any recommendations on architecture language, and does not make forecast on future trends.
 
Background of languages:
The comparison of the origination of the two languages reveals that PHDs are typically good at exploring in-depth technologies while computer technologies are not necessarily the contributions of computer professionals.


Language and SDK analysis:
Node.js adopts JavaScript syntax, endowing it with basic features such as flexibility, process-orientation and single-process and single-thread execution. Thanks to its flexible language, some object-oriented features can also be achieved through logic code. But the slow development of ECMAScript has slowed down the Node.js transformation towards enterprise-level application syntax. Node.js-featured asynchronous IO and event callback make it more suitable for server programming, and its single-process and single-thread execution also simplifies development. Thanks to the active community, the language has been enjoying fast development, and SDKs are also constantly enriched and stabilized.
In comparison, Java is object-oriented and has become even more powerful and stable after 20 years of development. Compared with Node.js, Java is a giant with a breadth of expertise in various fields. But it is just because of this that Java is much more costly to study than Node.js is. Every small technical detail of Java is worth a thick book. Java is also keeping abreast with the times by supporting asynchronous IO and event callback in its new SDKs, and Java open-source projects are also continuing to grow.

Third-party open-source framework selection:
After the language is decided, the framework selection follows. A good framework can save a lot of unnecessary duplicated efforts to easily empower the project to have powerful features. Of course, the introduction of third-party open-source frameworks also gives rise to the learning costs. Similarly, Node.js frameworks feature a low learning cost due to its short history and developers may find it easier to access more underlying source code, but some frameworks are prone to stability and compatibility issues. In addition, NPM developers vary in their development skills and there are no effective evaluation mechanisms. So you need to be cautious when selecting some modules (especially C/C++ modules). Java third-party open-source frameworks have been widely applied in a lot of enterprises and feature mature and stable performance and powerful features, as well as well-designed encapsulation and layers. After a higher learning cost, developers can enjoy a foolproof usage. In terms of Web development systems, both programming languages can find many open-source frameworks ready to be reused and introduced.

Productization analysis:
In terms of productization, Node.js, although making progress in various aspects, has a long way ahead to catch up with Java. For example, it is not as well-designed as Java system in system monitoring and performance analysis fields; restricted by its single-process and single-thread mode, Node.js is not as flexible as Java in stable deployment. Node.js' flexible script language and short history leave Node.js systems a large space for improvement in terms of security. Meanwhile, when both the front-end and back-end code use JavaScript code and the code is saved in the same branch, it is not clear enough to differentiate front-end and back-end code through directories alone, thus code obfuscation. But I believe the disputes and problems are temporary and the fast-developing Node.js will be improved step by step.

Execution engine analysis:
V8 engine is widely known and praised for its browser support. This is also why Node.js chose V8, the fastest JavaScript execution engine. But on the other hand, V8 engine's browser-oriented design also severely shackled Node.js's performance in the server field. Because the father and technologies of V8 engine are all from Java VM, some Java VM technologies are adapted to browser business. So in comparison, Java VM is more mature and more well-developed, and of course more complicated and clunky.


Other comparisons:
As follows:


Concluding remarks:
Node.js's asynchronous IO and event callback are its trump card, but other programming languages are also catching up on this. But Node successfully uses one language for both the front-end and back-end code, which is definitely second to none and has attracted lots of developers. But V8 engine contributes to both the success and the cause of failure. Its development is not light-packed, but Node.js is still young and developing quickly. I believe with the merge of IO.js and Node.js and more and more developers joining in Node.js, Node will become more and more stable and mature.
In comparison, Java is a giant in programming field. 20 years of development makes it mature and stable, with a sound ecological system. The flow of Android again puts this language to a pinnacle and it is always a key option in architecture selection.

Latest likes:

BennyFraneckiBennyF... kokleong98kokleo... yuliayyuliay
Guest