The best and fastest way to learn a new language is to think in contrast to the language now mastered. The company recently has a new project, to use Nodejs development, now Nodejs is very mature, you can try. began to re-study, consider, can write a series of PK articles, can help just contact Nodejs friends, easy to get started. For many years Java development, using Nodejs and Java to do contrast, to a PK. Write this article is not to distinguish who wins who negative, just to learn. Two languages, each have a characteristic, each has the characteristic.
Environment construction: Nodejs wins JavaNodejs Download an official installation package, step by step installation is OK, command line can use Nodejs. Java installation requires the installation of JDK and JRE, as well as the configuration of environment variables. It's not complicated, but it's still a bit difficult for beginners. So I think Nodejs's environment is easier to build than Java.
Learning Difficulty: Nodejs wins JavaNodejs language is based on JavaScript, the language comes out very early, do the Web application of the students will point. So learning difficulty is not high, but want to learn, or need some kung fu. Want to learn Java, to learn a lot of things, starting from J2SE, and then the Java EE, and then a variety of frameworks, databases, servers, the front-end knowledge, will point. So I like to put Java into the programming of the nine Yang Martial, internal strength. Java is a very good language, suggesting that you have not learned a friend, have the opportunity to learn. After learning Java, it is easier to learn any other language. Java comparative synthesis, learning curve than Nodejs long, in learning, Nodejs wins.
Project support: Java wins NodejsBoth Nodejs and Java can do Web projects, or they can do some service-providing projects. Nodejs said is the concurrency support is very good, in fact, he is single-threaded, queue mode, no multi-line Cheng said, so there is no concurrency problem. Java has always been a leader in enterprise application development, and it is no doubt that the appropriate scenario is more than Nodejs, multi-threading, high concurrency, support is very good. Project support on each of the features, suitable for different scenarios of the project. However, the current large-scale projects, the use of Java development, so project support, Java wins.
Open source components: Java wins NodejsNodejs inside components, like Java inside the jar package, are placed directly in the project reference. Nodejs and Java have a lot of open source components, Java development time is relatively early, so Nodejs currently no more than Java. But some of the components of Nodejs's daily development are already there, and they are expanding, and there should be more in the future. The components in Nodejs are called Node_module, and are made up of JS code. There is a very useful tool, NPM, similar to Maven in Java, to facilitate the management of references. Project to write a configuration file, the component name and version number using the Key-value format, NPM install, it is all downloaded. The configuration file in Nodejs that needs to be introduced into the component is in JSON format, and the MAVEN configuration file called Package.json,java is in XML format, called Pom.xml. Nodejs components are downloaded from the source code to facilitate direct viewing of reading. The jar package in Java is downloaded as a class file, and if you need to view the source code, you need to download SRC separately. This, Nodejs is more convenient than Java.
operating Environment: Nodejs wins JavaThe Java Web Project Runtime environment requires a separate installation environment, such as Tomcat,jetty,jboss, and so on, which is commonly used by Tomcat. Nodejs's operating environment is node, which can be run without installing additional software. This point of convenience, Nodejs wins.
development tool: Nodejs plain JavaNodejs now has good tools to support, such as Webstorm,sublime2,aptana and so on, anyway a lot. Java does not have to say, often have eclipse, IntelliJ idea and so on. The tools are all well supported and played in a tie. OK, the 1th round PK here, and then began to use the actual project to do the comparison.
Nodejs PK Java 1th round: First clash