Compare of Node.js and Vue.js - bernardopnunes/SoftwareEngineeringSDUW GitHub Wiki

Group

goodgood


Index

  1. Node.js
  • Interview
  • Instance
  • Advantages and Disadvantages
  1. Vue.js
  • Interview
  • Instance
  • Advantages and Disadvantages
  1. Compare
  2. Summary
  3. Reference

Node.js

Interview

Node.js is a Javascript runtime environment ,released in May 2009, developed by Ryan Dahl, essentially encapsulates the Chrome V8 engine. Node.js optimizes some special use cases and provides alternative APIs to make V8 run better in non-browser environments. The V8 engine executes Javascript very fast and the performance is very good. Node.js is a platform based on the Chrome JavaScript runtime, used to easily build fast-responsive, easily-expandable web applications. Node.js uses event-driven, non-blocking I / O model to be lightweight and efficient, very suitable for running data-intensive real-time applications on distributed devices. To put it simply, node.js is a javascript running environment, which can make javascript run away from the browser.

Instance

var server = require("http");
server.createServer(function(request,response){
response.writeHead(200,{"Content-Type":"text/html"});
response.end("Hello,NodeJS");
}).listen(9000);
console.log("server running at http://127.0.0.1:9000");

Advantages and Disadvantages

Aadvantages:

  1. Higher performance in high-concurrency scenarios Before using http://socket.io, the push service was done with ajax polling. We have used Tornado and Node.js to do two versions of push service. In the test environment at that time, CPU time of Node.js was one-third of Tornado, memory usage was half of Tornado, and the number of lines of code was only one-third of Tornado (Node.js version was written in coffee). Later we used http://socket.io, and the CPU overhead was further reduced.
  2. Functional programming is very suitable for writing asynchronous callback chains It is very convenient to write asynchronous operation chains with Node.js and CoffeeScript. In contrast, whether Tornado writes callbacks for named functions or yields a Task is not so natural.

Disadvantages:

  1. A large number of anonymous functions make the exception stack unsightly.
  2. It is not possible to catch exceptions in units of request. You must ensure that you do not throw exceptions in callbacks of third-party libraries that do not catch exceptions. This is a troublesome task in an asynchronous operation chain. One solution is to encapsulate third-party libraries that don't catch exceptions, turn all exceptions into events, and change to APIs of the form on ('error').

Vue.js

Interview

Vue.js is a progressive framework for building user interfaces.Unlike other heavyweight frameworks, Vue is designed to be developed incrementally from the bottom up.The core Vue libraries focus only on the view layer and are very easy to learn and integrate with other libraries or existing projects.On the other hand, Vue is fully capable of driving complex single-page applications developed using single-file components and libraries supported by the Vue ecosystem.

Instance

<html>
       <head>
              <meta charset="utf-8" />
              <title>一个简单的vue实例</title>
              <!--引入vue的库-->
              <script src="vue.js"></script>
       </head>
       <body>
              <div id="root">{{msg}}</div>
              <div id="root2"></div>
              <script>
                     //创建一个vue实例--与ID为root的结点进行绑定--data 是vue实例中的一些数据存放地点
                     new Vue({
                            el:"#root",
                            data:{
                                   msg:"hello world"
                            }
                     })
              </script>
              <script>
                     //原生js实现
                     var dom =document.getElementById("root2");
                     dom.innerHTML="hello world!";
              </script>
       </body>
</html>

Advantages and Disadvantages

Advantages of vue

  1. simple to use
  2. flexible
  3. lightweight and high performance:20kb After the compressed size;virtual DOM
  4. MVVM: Data - Driven views; General mode of operation is DOM; Common Javascript Data
  5. modularization:Improving the development efficiency convenient for the reuse simplify debugging steps improve the maintainability of the whole project for collaborative development

Disadvantages of vue

  1. vue has no shortage of getting started,but lacks of Higher - Order tutorial
  2. Vue does not support ie8
  3. little community

Compare

1. Different service environment

Node.js is a front-end framework, vue.js is a server-side language. Node.js is the runtime environment of Javascript , analogous to jvm(Java Virtual Machine) in java. The role of node.js is the same as that of jvm, and it is also the running environment of Javascript. No matter what operating system you are, as long as the corresponding version of node.js is installed, you can use Javascript to develop background programs. Vue.js is a progressive framework for building data-driven web interfaces. The goal of Vue.js is to implement the response view data binding and combined view component through the simplest API possible. It is not only easy to get started, but also easy to integrate with third-party libraries or existing projects.

2.Different operating environment

Node.js is a JavaScript running environment based on ChromeV8 engine. Vue.js uses HTML-based template syntax, allowing internal developers to declaratively bind the DOM to the data of the underlying Vue instance. The core of Vue.js is a system that allows you to use declarative template syntax to declaratively render data into the DOM.

3.Different usage data

Node.js uses an event-driven, non-blocking I / O model, making it lightweight and efficient. Vue.js has a route called vue-route.js, and vue.js also has a data request called vue-resource.js. Vue.js can be referenced in HTML, and the introduction of npm is convenient for package management. Vue.js is a progressive framework for building data-driven web interfaces. The goal of Vue.js is to implement responsive data binding and combined view components through the simplest possible API. It is not only easy to get started, but also easy to integrate with third-party libraries or existing projects.


Summary

In conclusion,Vue.js and Node.js are fundamentally different.Vue.js is a progressive framework for building data-driven web interfaces.,while Node.js is created to be implemented on the serve side.They do well in seperate field.However,combining these two framework to design in the web work can be very effective.


Reference

https://baike.sogou.com/m/fullLemma?key=node.js

https://www.cnblogs.com/masterhxh/p/12655007.html

Division of work

  • Meilin Guo(@juicyguo) summary
  • Ziyue Wang(@Ashley-zy)comparison
  • Yilin Li(@SakuraLyl)Introduction and examples of node.js
  • Ye Tao(@taoye886)The advantages and disadvantages of node.js
  • Jinran Wang(@Eilands) do wikipage
  • Mufeng Su(@su-mufeng) do wikipage
  • Xinyi Dai(@DaisyDai233) The advantages and disadvantages of vue.js
  • Shaofei Xu(@Sophie973) comparison
  • Rao Wang(@Wendy-rao) Introduction and examples of vue.js
⚠️ **GitHub.com Fallback** ⚠️