Who is the father of Node?

That’s right! This is the man Ryan Dahl who created Node in 2009. You see, in fact is not to say that god did not have hair, this god hair is not very exuberant! However, since Node was created in 2009, we have to make fun of JS at that time. Everyone knows what JavaScript was like in 2009 (were you in the game at that time), ES5.0(the immature ES5) was just released at the end of 2009, and ES5.1(as we now use ES5) was released in June 2011 and became an ISO international standard.

Imagine how much fun JS is still being made of it even with ES6 ~ ES2020, let alone when ES5 wasn’t even popular. At the time there was no proper asynchrony, no modularity, no package management. It is a disaster to write JS for large projects or server projects, which leads to various modularization schemes (Node uses CommonJS), as well as historical problems such as NPM and node_modules. On the one hand, Ryan Dahl’s technology was not as good as it is now, and his ideas were not as comprehensive as they are now. On the other hand, JS in those days was inherently poor, and the things created by it would not be perfect.

But now JS is growing stronger and stronger, although it is still very pits, but compared to the former JS is simply a hundred times better. Not only does it have modularity of its own, but it also has Promise, Proxy, Bigint, block-level scope, and other very useful features, and better TypeScript to carry the load for JavaScript. Node’s historical baggage is so heavy that it has to change from.js to.mjs to maintain compatibility even if it wants to support standard modularity.

Deno cause

The father of Node didn’t always maintain Node. He left NodeJS to join Google, where he focused on image coloring and hyperresolution in machine learning. Despite these achievements, Ryan Dahl believes that machine learning is still very simple and is still a long way from true artificial intelligence. But that doesn’t stop people from working on machine learning, because he believes ai will become better and better one day.

When it comes to machine learning and artificial intelligence, we have to talk about Python. Node’s dad never liked Python very much, so he wanted to build an AI framework for JavaScript (and maybe learn an AI framework for the front end in the future). By the time he got back to Node.js, he found that the project had gone the other way and had problems he couldn’t ignore.

What the hell is this? What the hell is that? As it turns out, he thinks he made too many mistakes in building NodeJS. He even listed ten mistakes he made in designing NodeJS at the 2018 JS Developer conference:

  • Didn’t stick with the Promise
  • Not focusing on safety
  • No switch from GYP build system to GN
  • Continue to use GYP, FFI is not provided
  • Package. json and depend on NPM
  • Require (” somemodule “) anywhere
  • Package. json provides the wrong concept of module
  • Design software black hole node_modules
  • Require (“module”) may not write.js
  • index.js

To make up for these mistakes, he developed a new project to address his ten (actually many more) pain points: Deno.

Deno technology

The underlying dependency of Node is C++. Is Deno the same?

The answer is no. Some programmers may remember that Deno’s initial reliance on the Go language caused quite a stir in the GoLang community. But it was Rust. Then many people took the opportunity to black Go blowing Rust.

As for Rust, Ryan Dahl said it was because he didn’t want to have two GCS (Go and TS).

Deno name

If you’re careful, you might notice that the four letters deno are just the four letters of node, reversed:

  • de + no = Deno
  • no + de = Node

Does reversing the letter “Node” mean subverting “Node”?

It’s pretty much the same, it means: Destroy Node!

Ryan Dahl seems to have a lot of faith in his Deno, and I hope it kills Node because it’s so good!

Let’s take a look at some of the advantages of Deno:

The advantage of Deno

The built-in TSC engine allows you to run ts code directly (again, compile it to JS first). This eliminates the need to manually compile your ts code every time you write it, and eliminates the need to build t-nodes. Its internals are determined by the file name suffix. If it is a.ts suffix, the ts compiler is called first to compile it into JavaScript. If it is a.js suffix, pass it directly to the V8 engine and run.

Developed in the Rus T language, Rust natively supports WebAssembly, so it can also run WebAssembly directly. Instead of using the Libuv library, it uses Rust’s Tokio library to implement event loops for its asynchronous operations.

So why use Rust instead of C++ like Node? This is mainly because Rust provides a lot of ready-made modules that, for Deno, can save a lot of development time. Perhaps seeing how many off-the-shelf modules Rust offered, Deno decided to add a lot of them to its own projects.

Deno has security control. By default, scripts do not have read and write permissions. An error will be reported if the script reads or writes to the file system or network without authorization. To read and write to the file system, you must explicitly enable permissions. In his summary of Node’s 10 mistakes, Ryan said that V8 itself has a good sandbox architecture, but sometimes Node itself doesn’t take advantage of it. For example, there are instances where it can directly read Memory, or linte R can directly use network functions. Downloading a package from NPM and letting it run is a major security risk.

Deno supports Web API, which is as consistent as possible with the browser. It provides the global object window and supports Web standards such as FETCH, webCrypto and Worker, as well as event operation functions such as OnLoad, onUnload and addEventListener. Unlike Node, the inconsistency between Web API and Node API only increases the cost of learning for developers. The window global object is not limited to the browser environment.

Deno supports only ES modules, which are consistent with the browser’s module loading rules. There is no NPM or npm_modules bottomless pit, no CommonJS module support, and no package.json file required. All modules are loaded via a URL, such as import vue from “.vue.org” (absolute address) or import vue from ‘./vue.runtime.js’ (relative address). As a result, Deno does not need a centralized module storage system and can load modules from anywhere. However, after Deno downloads the module, there will still be a total directory that caches the module locally, so it can be used offline. So there’s actually a folder that looks like npm_modules.

Deno builds in all the features developers need, eliminating the need for external tools. There are special commands for packaging, formatting, testing, installing, documentation, linting, compiling scripts into executable files, etc. I wonder if Webpack will be killed on the way to Node.

Deno disadvantage

While NodeJS is no match for this comparison, there is one thing that Deno can’t match for the time being: its huge ecology.

Just like C# and Java, are they really that far apart? Well, not really, but there are a lot of ecological reasons for the lack of popularity.

Just like Huawei wants to build its own Hongmeng system, even if it can be better than Android, Android’s huge ecosystem is enough to stay ahead for many years. Isn’t that what happened to Windows Phone? No one wants to buy a Windows Phone without any software.

Ryan stated that Deno is currently not planning to make Node compatible, which means there are many things that work on Node that don’t work on Deno. It’s up to the wheel enthusiasts to see if they want to make a new one on Deno.

If React and Vue build ecology from Deno, then Deno’s future is really bright, hope that day can come soon.

Important note

In the past, a group of Chinese programmers posted a similar post to the Deno issue in the form of a post bar:

  • To learn without moving
  • Please don’t update
  • The front end is too difficult

“, other issues were submerged, resulting in Ryan directly shut down the issue, the image of Chinese programmers in the world even more plummeted. If you can’t learn, you can not learn, do not look for that high-end position is, not all positions require you to be a full stack.

But please don’t give all Chinese programmers a bad name, thank you!

Previous excellent article

  • Microsoft launches comments section on GitHub
  • Vue 3.0.3: New CSS variable passing and the latest Ref Proposal
  • “Don’t underestimate the nine grid, one question can let a candidate reveal his true colors!”
  • “Mobile Layout Interview Questions to test your CSS Skills (Center)”
  • A series of confusing behaviors after setting prototype Objects as Proxies
  • Vue’s Super Fun New Feature: DOM Portal
  • A fun new feature of Vue: Introducing JS variables into CSS
  • Create your own Visual Data Map without any libraries
  • “Use of React’s Super-popular CSS-in-JS Library in the Vue Project: Styled – Components”
  • Is It Finally Vue’s Turn to Inspire React?
  • A Small Pit in Vue3 on IOS
  • Upgrade your React project to Immer instead of Immutable by 2020
  • “Soul Interrogation from the Author of React Hooks and Immutable”
  • Good news, Vue3 official document is available in Chinese!
  • Hooks use of the New VUe-Router
  • Vue 3:20 Years of Status Updates
  • React 17 is officially a transition version!
  • Yu Yuxi: The Design Process of Vue3
  • The Vue3 beta was released early this morning and openly supports scaffolding!