10 Things I Regret About Node.js

Nick Taylor (he/him) on June 07, 2018

Photo courtesy of flickr user Trygve Lie. The creator of Node JS, Ryan Dahl, recently gave a talk at JSConf EU 2018 titled "10 Things I Regret Abo... [Read Full]
markdown guide
 

The goal of Node was event driven HTTP servers.

5:04
1 Regret: Not sticking with Promises.
* I added promises to Node in June 2009 but foolishly removed them in February 2010.
* Promises are the necessary abstraction for async/await.
* It's possible unified usage of promises in Node would have sped the delivery of the eventual standartization and async/await.
* Today Node's many async APIs are aging baldly due to this.

6:02
2 Regret: Security
* V8 by itself is a very good security sandbox
* Had I put more thought into how that could be maintained for certain applications, Node could have had some nice security guarantees not available in any other language.
* Example: Your linter shouldn't get complete access to your computer and network.

7:01
3 Regret: The Build System (GYP)
* Build systems are very difficult and very important.
* V8 (via Chrome) started using GYP and I switched Node over in tow.
* Later Chrome dropped GYP for GN. Leaving Node the sole GYP user.
* GYP is not an ugly internal interface either - it is exposed to anyone who's trying to bind to V8.
* It's an awful experience for users. It's this non-JSON, Python adaptation of JSON.
* The continued usage of GYP is the probably largest failure of Node core.
* Instead of guiding users to write C++ bindings to V8, I should have provided a core foreign function interface (FFI)
* Many people, early on, suggested moving to an FFI (namely Cantrill) and regrettably I ignored them.
* (And I am extremely displeased that libuv adopted autotools.)

9:52
4 Regret: package.json
* Isaac, in NPM, invented package.json (for the most part)
* But I sanctioned it by allowing Nod's require() to inspect package.json files for "main"
* Ultimately I included NPM in the Node distribution, which much made it the defacto standard.
* It's unfortunate that there is centralized (privately controlled even) repository for modules.
* Allowing package.json gave rise to the concept of a "module" as a directory of files.
* This is no a stictly necessary abstraction - and one that doesn't exist on the web.
* package.json now includes all sorts of unnecessary information. License? Repository? Description? It's boilerplate noise.
* If only relative files and URLs were used when importing, the path defines the version. There is no need to list dependencies.

12:35
5 Regret: node_modules
* It massively complicates the module resolution algorithm.
* vendored-by-default has good intentios, but in practice just using $NODE_PATH wouldn't have precluded that.
* Deviates greatly from browser semantics
* It's my fault and I'm very sorry.
* Unfortunately it's impossible to undo now.

14:00
6 Regret: require("module") without the extension ".js"
* Needlessly less explicit.
* Not how browser javascript works. You cannot omit the ".js" in a script tag src attribute.
* The module loader has to query the file system at multiple locations trying to guess what the user intended.

14:40
7 Regret: index.js
* I thought it was cute, because there was index.html
* It needlessly complicated the module loading system.
* It became especially unnecessary after require supported package.json

15:28 Talks about Deno.

 

From someone who often forgets his headphones you sir are awesome.

 
 
 

I have an odd question born of lazyness I admit: would you mind summarizing or listing the 10 points in your post?

I've never used Node.js but I'm still curious and this might help the conversation :D

 

I'll summarize it later tonight my lazy friend ;)

 

Posted a few of the items he mentioned during my coffee break. Gotta give it a second listen to gather the rest.

 
 

I think every software developer can learn a lot from this video. It's pretty inspiring to see someone as big in the industry as him admitting his mistakes. These were not on the lines of "yeah, that was a small mistake it doesn't matter", but he totally meant "I screwed up, big time".

 

I rarely have a conflict with Build System but when I do. Damn that GYP! #REBUILD

 

What I took from this video is that node.js is destined to be replaced by competitor that solves a lot of the issues that node does not currently do well, because they were added as afterthoughts. I don't know of such a competitor that currently exists (aside from the presenter's attempt), but it is only a matter of time.

 

They also discuss Ryan's talk on JS Party episode 29: Node's survey, Ry's regrets, Microsoft's GitHub. If you're not already subscribed to this podcast, I highly recommend it.

 

I'm excited to see where the Deno project goes as I'm a big fan of TypeScript.

 

One thing that I don't understand. Why did he created new kind of Node? Why not use another language instead?

 

I asked the same. I guess it's because he's a builder. Thanks to people like him, today we have many alternatives in the world of software.

 

When I asked the question I didn't watch the full talk.
After watching the talk, however, I know that the author really likes JavaScript. That is the reason he didn't choose another language.

 
code of conduct - report abuse