Javascript Should Come With Batteries

Rate this content
Bookmark

Setting up JavaScript projects is no fun. Getting started involves installing and configuring node, tsc, prettier, eslint, a testing framework, a database driver, and more. Why is JavaScript not batteries included? In this talk we'll talk about how Deno fixes this, letting you focus on building stuff. We explore what benefits full tooling integration unlocks, and remember how fun it is to program if your tools help you, rather than requiring your babysitting.

Luca Casonato
Luca Casonato
30 min
08 Dec, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

JavaScript Should Come With Batteries: Deno is a next-generation JavaScript runtime that addresses the lack of built-in tooling in JavaScript. It provides a secure and simple way to develop applications with built-in testing, linting, formatting, and a language server for VS Code. Deno is compatible with Node.js and NPM, supports web standard APIs, and allows code portability between frontend and server. It also offers features like a built-in database, a key-value store, and transparent monetization with Deno Deploy.

1. Introduction to JavaScript and Talk Premise

Short description:

Hey, folks. Thank you all for being here. I'm Luca, a software engineer at the Deno company. My talk is JavaScript Should Come With Batteries. JavaScript lacks an extensive standard library and default tooling, requiring developers to configure everything themselves. This includes formatters, linters, testing frameworks, and additional packages for various tasks.

Hey, folks. Thank you all for being here. I know it's very late. You're probably all very tired and want to go home. So I'll tell you something about not React, for once. You've probably had a lot of React talks today because we're at a React conference. But I don't know. I'm going to talk about more JavaScript because, hey, React is really just JavaScript, right? And why don't we talk a little bit about JavaScript?

So my talk is JavaScript Should Come With Batteries. And let me explain... Actually, let me first introduce who I am. That's probably useful. So I'm Luca. I'm a software engineer at the Deno company. Some of you may have heard of Deno. If not, I'll get to that in a second. I work on various things related to Deno. I built a frontend framework for Deno called Fresh, that some of you may have seen. And I do a bunch of standards work at T-SYS39, standardizing the JavaScript language. And at WhatWig and W3C, standardizing things like Fetch, HTML. And I'm a co-chair at Widger CG, which is a community group at the W3C where we try to make server-side JavaScript runtimes more interoperable. So making node.js work better with Deno, and Deno better with CloudFlow Workers, with RUN, with whatever, right?

So about my talk today. I have this premise that I'm going to try to argue, which is that JavaScript is too bare bones and this is bad. And what I mean by this is that JavaScript doesn't really have an extensive standard library or default tooling. But rather, everybody sort of has to pack everything they want in their project together themselves. And this means that if you're setting up a new project, you have to go stare at a table like this and fill in the right-hand side. I need a formatter, so let me choose a formatter. Do I use Dprint, do I use Prettier, do I just use auto-formatting in VS Code, or do I use none? Linting, testing, do I want to use TypeScript or not? If so, now I need to have all of my tools support TypeScript. Maybe I want to set up benchmarking, documentation generation, if I have a library. And then you need to pull in a bunch of packages for things that you're going to need to do. You need to pull in a package to do YAML parsing because you have a config file that's written in YAML that some other team gave you.

2. Challenges with Tooling and Dependencies

Short description:

Or you have some service that you're calling and it fails very frequently, so you want to do that with retries, you need to pull in some library for that. And this ends up with every tool and API that you need, you need to have one more package that you install. So you have this very large package.json folder. And this becomes even more complicated because there's so many different tools out there. When you want to use them together, things become even more complicated.

Or you have some service that you're calling and it fails very frequently, so you want to do that with retries, you need to pull in some library for that. And this ends up with every tool and API that you need, you need to have one more package that you install.

So you have this very large package.json folder. And this becomes even more complicated because there's so many different tools out there. When you want to use them together, things become even more complicated. You can install ESLint. I hope your beer's fine. So when you install ESLint and you want to use that with TypeScript, that doesn't work out of the box. You need to install another tool called TypeScript ESLint. You don't just install one, you install two packages, you add a bunch of stuff to your ESLint config file, you need to have a config file for ESLint also. Same thing with JSX, you need to add plugins for that. ESLint is pretty good about ESM.

One of the standout tools here regarding ESM support still couldn't use config files up until a couple weeks ago, months ago, I don't know. But there are some really bad ones, and I don't mean to hate on the folks building Jest. A lot of this boils down to other projects that they use not supporting tools well, but Jest and TypeScript, getting that set up, not fun. You want to throw JSX into the mix, you need to set up more config. Here, you're not even setting up config for Jest, you're setting up config for Babel? It's like, okay, I guess I'm using Babel now. And ESM, just don't use ESM if you use Jest. If you want to test in ESM, just don't use Jest. And then your node module folder looks like this. You have 100 dependencies in your package.json, and a 300 megabyte node module folder. And you just have a config file, and then you have a project like this, right? And imagine coming to a company and you download the repo, and you want to start working, and you're greeted by this. This is not fun. This is not something you want. You just want to get set up and everything just works. And you want to start a new project, you don't want to have to set this up. You just want to have it work out of the box. So how do we solve this? And as a JavaScript developer, you may be wondering, like, yeah, how do we solve this? But if you sort of float around other language ecosystems sometimes, you can see that some ecosystems solve this really well. Some do it very poorly, but some do it really well. For example, Rust and Go.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Node.js Compatibility in Deno
Node Congress 2022Node Congress 2022
34 min
Node.js Compatibility in Deno
Can Deno run apps and libraries authored for Node.js? What are the tradeoffs? How does it work? What’s next?
Deno 2.0
Node Congress 2023Node Congress 2023
36 min
Deno 2.0
Top Content
Deno 2.0 is imminent and it's bringing some big changes to the JavaScript runtime. In this talk, we'll introduce the new features including import maps, package.json auto-discovery, and bare specifiers. We'll discuss how these improvements will help address issues like duplicate dependencies and disappearing dependencies. Additionally, we'll delve into the built-in support for deno: specifiers on the deno.land/x registry and its role in providing a recommended path for publishing. Come learn about how these updates will shape the future of the JavaScript ecosystem and improve backwards compatibility with Node applications.
Bun, Deno, Node.js? Recreating a JavaScript runtime from Scratch - Understand magic behind Node.js
Node Congress 2023Node Congress 2023
29 min
Bun, Deno, Node.js? Recreating a JavaScript runtime from Scratch - Understand magic behind Node.js
Bun, Deno, and many other JavaScript runtimes have been hyped, but do you know why? Is it that easy to make a runtime from scratch?

I've been researching the secret behind Node.js' power and why there are so many new JavaScript runtimes coming up. Breaking down each key component used on Node.js I've come to interesting conclusions that many people used to say whereas in practice it works a bit differently.

In this talk, attendees will learn the concepts used to create a new JavaScript runtime. They're going to go through an example of how to make a JavaScript runtime by following what's behind the scenes on the Node.js project using C++. They'll learn the relationship between Chrome's V8 and Libuv and what makes one JavaScript runtime better than others.

This talk will cover the following topics:
- What's a JavaScript Engine - V8
- Why Node.js uses Libuv
- How to create a JS Runtime from scratch
Writing universal modules for Deno, Node, and the browser
TypeScript Congress 2022TypeScript Congress 2022
25 min
Writing universal modules for Deno, Node, and the browser
This talk will walk you through writing a module in TypeScript that can be consumed by users of Deno, Node, and browsers. I will walk through how to set up formatting, linting, and testing in Deno, and then how to publish your module to deno.land/x and npm. I will also start out with a quick introduction on what Deno is.
Fresh: a new full stack web framework for Deno
Node Congress 2023Node Congress 2023
24 min
Fresh: a new full stack web framework for Deno
Fresh is a web framework based on Deno and Web standards built to run on the edge
Experimenting with Deno for Easier Kubernetes Deployments
DevOps.js Conf 2022DevOps.js Conf 2022
31 min
Experimenting with Deno for Easier Kubernetes Deployments
As we all know, dealing with Kubernetes YAML is not very intuitive (especially for those just getting starting) and the more resources and dependencies are added the messier and more complex the process becomes. In this talk, we'll explore how we can use Typescript and Deno to bring typing, composition, code-reuse, and testing as an alternative to YAML - that doesn't include these capabilities, all while still remaining declarative and easy to use.

Workshops on related topic

Building a Hyper Fast Web Server with Deno
JSNation Live 2021JSNation Live 2021
156 min
Building a Hyper Fast Web Server with Deno
WorkshopFree
Matt Landers
Will Johnston
2 authors
Deno 1.9 introduced a new web server API that takes advantage of Hyper, a fast and correct HTTP implementation for Rust. Using this API instead of the std/http implementation increases performance and provides support for HTTP2. In this workshop, learn how to create a web server utilizing Hyper under the hood and boost the performance for your web apps.
Writing Universal Modules for Deno, Node and the Browser
Node Congress 2022Node Congress 2022
57 min
Writing Universal Modules for Deno, Node and the Browser
Workshop
Luca Casonato
Luca Casonato
This workshop will walk you through writing a module in TypeScript that can be consumed users of Deno, Node and the browsers. I will explain how to set up formatting, linting and testing in Deno, and then how to publish your module to deno.land/x and npm. We’ll start out with a quick introduction to what Deno is.