Node.js is Dead – Long live Deno!

Share
  • January 6, 2020

Deno versus Node.js

JAXenter: Hello Krzysztof! You are an expert in Deno – a new JavaScript Framework created by the Node inventor Ryan Dahl. Can you briefly explain what Deno is exactly?

Deno aims to fix Node.js design mistakes and offers a new modern development environment.

Krzysztof Piechowicz: Deno is a new platform for writing applications using JavaScript and TypeScript. Both platforms share the same philosophy – event-driven architecture and asynchronous non-blocking tools to build web servers and services. The author of Deno is Ryan Dahl, original creator of Node.js. In 2018, he gave the famous talk “10 Things I Regret About Node.js“ and announced his new project – Deno. Deno aims to fix Node.js design mistakes and offers a new modern development environment.

JAXenter: How does Deno differ from Node.js?

Krzysztof Piechowicz: Both platforms serve the same purpose, but use different mechanisms. Deno uses ES Modules as the default module system, whereas Node.js uses CommonJS. External dependencies are loaded using URLs, similar to browsers. There is also no package manager and centralized registry, modules can be hosted everywhere on the internet. Contrary to Node.js, Deno executes the code in a sandbox, which means that runtime has no access to the network, the file system and the environment. The access needs to be explicitly granted, which means better security. Deno supports TypeScript out of the box, which means that we don’t need to manually install and configure tools to write TypeScript code. Another difference is that Deno provides a set of built-in tools, like a test runner, a code formatter and a bundler.

Deno – an example

JAXenter: Can you pick out a difference and demonstrate it with an example?

Krzysztof Piechowicz: In my opinion, the most important difference is how modules are imported. As I mentioned, Deno doesn’t use the CommonJS format and doesn’t provide a package manager like npm. All modules are loaded directly in code using an URL.

Here is a Node.js example:


And here is a Deno example:


At first glance, the Node imports look simpler, but there are a few advantages to using the Deno style. By importing code via URL, it’s possible to host modules everywhere on the internet. Deno packages can be distributed without a centralized registry. There is also no need for the package.json file and a dependency list, because all modules are downloaded, compiled and cached on the application run.

JAXenter: What is the current status of Deno? Can it already be used in production?

Krzysztof Piechowicz: Deno is still under heavy development and isn’t production-ready yet. There is also no official date for the release of the 1.0 version.

The future of Deno

JAXenter: What’s the next step with Deno? Is it actively being developed? By whom, in which direction?

The goal of Deno is not to replace Node.js, but to offer an alternative.

Krzysztof Piechowicz: Deno is an open-source project and is being developed very actively. The project was started in 2018 by Ryan Dahl. Currently, the project has over 150 contributors. Besides the release of the 1.0 version, there is a plan to provide a command-line debugger and built-in code linter to improve developer experience. Deno should also serve HTTP more efficiently.

JAXenter: What is the core message of your session at iJS?

Krzysztof Piechowicz: The goal of Deno is not to replace Node.js, but to offer an alternative. Some of the differences are quite controversial and it’s hard to predict if they will format in a correct way. I recommend that all Node.js programmers keep an eye on this project. I’m not sure if this project will be a success, but it’s a great opportunity to observe how Node.js could have been implemented differently.

JAXenter: Thank you very much!

Deno – a better Node.js?

Watch Krzysztof Piechowicz’s session from iJS 2019: Deno – a better Node.js?

Krzysztof Piechowicz is a Senior Software Engineer at adesso AG. He is mainly concerned with Node.js, Typescript, React and software architecture topics. He is a big fan of agile software development.

The post Node.js is Dead – Long live Deno! appeared first on JAXenter.

Source : JAXenter