DEV Community 👩‍💻👨‍💻

Jason Shelley
Jason Shelley

Posted on

Should You Learn Deno in 2022?

If you are a JavaScript developer, perhaps you have heard of a new JavaScript runtime called Deno. Like me, you probably thought: “Oh no! Here we go again. Is this going to be another Nodejs vs io.js fiasco or npm vs yarn battle.” You might even have thought: “Yet another tool in the JavaScript ecosystem to make our lives miserable.” After all, JavaScript has a history of making developers feel exhausted. Is Deno going to be another reason for developers to dislike JavaScript?

The short answer is No. In fact, it’s the exact opposite. You should definitely learn Deno in 2022. If you want to know why, continue to read this article. If you are already convinced, great! Head over to the Deno website and start learning it for 2022.

Just Another Shiny Tool?

First off, let’s get this out of the way. Deno IS NOT just a new shiny tool for JavaScript. It solves real problems that JavaScript developers face and it offers real productive tools that can help JavaScript developers in our development process.

What is Deno?

The official Deno website said:

Deno (/ˈdiːnoʊ/, pronounced dee-no) is a JavaScript/TypeScript runtime with secure defaults and a great developer experience.

For any Nodejs developer, this explanation alone should make us excited. First, Deno is a JavaScript/TypeScript runtime. Let me repeat, Deno is a JavaScript/TypeScript runtime. It supports Typescript right out of the box! There is no need to download another tool or some transpiler to run your code. Deno treats these languages “pretty equally”.

The command to run JavaScript files is:

deno run YourFile.js
Enter fullscreen mode Exit fullscreen mode

The command to run TypeScript files is also:

deno run YourFile.ts
Enter fullscreen mode Exit fullscreen mode

You can even have files in both languages in your project. This allows developers to be extremely productive. TypeScript is extremely popular and useful in the development process. It helps developers create more clean, efficient and safe code. The Deno runtime offer this feature without any extra work from the developer. This allows developers to focus on building solutions instead of fiddling around with config files.

“…a runtime with secure defaults”.

You have to explicitly set the permissions for your script if you want it to have file, network or environment access. This means when you use a third party package, you will know what that script will access. This is really useful from a security perspective. For example, if you import a third party package named StringValidator and it wants access to the internet, you may want to double check to see what this package is really doing.

Deno can import modules from any location on the web. You also have the option to import your modules from the Deno hosting service, deno.land/x. If you do, you are guaranteed that the module will be there. Because all uploaded module versions are immutable, to prevent breaking programs that rely on them. If you start using a newer version of the module, and find there are security risks, you can easily revert back to the previous version without worrying.

“..a great developer experience”.

What would make Deno a better developer experience than Nodejs?

It’s web compatible. This means your Javascript knowledge that you learned from writing front end apps on FireFox, Chrome, Edge, etc is transferable to Deno. You can use Fetch, Web Workers, Web Storage, Blob, FormData, WebSocket, even Web Assembly and much much more. That’s less third party modules you have to worry about, bye-bye axios.
It has built-in utilities to make development easier. For example,

  1. Linter (deno lint)
  2. Bundler (deno bundler)
  3. Test runner (deno test)
  4. Code Formatter (deno formatter)
  5. Dependency Inspector (deno info)
  6. Documentation Generator (deno doc)

These are not “nice to have” tools. These are necessary tools. When developers see the runtime they are using provides these tools without any extra crazy annoying configuration, it builds their confidence in the runtime and in their ability to use the language better.

Deno also provides built-in modules that are supported by the Deno team. These modules are very useful for everyday programming tasks. For example, Collection module has functions to work with collections like groupBy, partition, union. DateTime module has functions to deal with dates. It also has a module to allow us to use Nodejs modules that do not use non-polyfilled Node APIs.

These are just some of the features that make Deno compelling to learn. But we still haven’t talked about: how Deno handles package management, how Deno handles promises, extending Deno with Rust plugins, Deno Deploy (a serverless solution allowing users to quickly script distributed HTTPS servers) and even compiling your scripts into a self-contained executables!!
Deno looks promising. It has a team of developers and investors to push it to the next level. 2022 is definitely going to be an exciting year for it. Even if it doesn’t replace Nodejs, it will definitely push everyone to a better JavaScript ecosystem.

Top comments (3)

Collapse
 
bugmagnet profile image
Bruce Axtens • Edited on

The absence of a good library for talking to SQLServer is all that's stopping me from using Deno for almost everything

Collapse
 
lil5 profile image
Lucian I. Last

In my eyes GoLang is the best language for Web servers

Collapse
 
idcmardelplata profile image
Martin Algañaraz

I thought the same until I met elixir

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. 🛠