Last updated: 2019-04-12
Szmozsánszky István "Flaki"
Developer Outreach / DevRel
Tessel Project, JS+HW hacker
István Szmozsánszky "Flaki"
a.k.a.: the burning questions of the JS ecosystem
- 2008: V8 (Node.js in 2009)
- 2013: asm.js (WebAssembly in 2015)
Birth of the GREAT DIVIDE
Universal & Isomorphic
“We’ve worked on multiple React projects, but in every case, the output was server-rendered. Developers get the benefit of working with a tool that helps them. Users don’t pay the price.” — Jeremy Keith
SSR! I cannot promise to explain away the framework churn, this isn't a talk for that, I would be up here all day. Jeremy Keith & Remy Sharp in their recent articles provide insights into one particular facet of this issue, though: does it matter, if the user won't see it?
Let's talk about Node.js
It earned its place (tooling, server-side)
- server side code (servers)
- functions (serverless)
- ssr/ssg (back-of-front-end)
Node.js & the Web
- missing secure sandbox
- unlimited file and network access
- native modules
- exec permissions
The Permissions Fissure
- network (request vs fetch -- CORS)
- filesystem (unlimited -- sandbox/dom api)
- native (high-speed) execution (native binaries vs …?)
- low-level features and system access (hardware, graphics)
- advanced processing features (threads, simd…)
With great power, comes great vulnerability
Node.js was inevitable
API convergence: slowly but surely
More on worker threads from Anna Henningsen
The prodigal son…
The prodigal son… returns?
Node.js is slowly finding its way back to the Web Platform:
- Various utility APIs (e.g. TextEncoder/Decoder)
- Cross-platform viable APIs (e.g. Performance Timing API)
- WebAssembly & ES Modules
À propos modules…
…has traditionally been perilous
Let's face it, JS wasn't great in isolation, especially async (commonJS is inherently sync - again, it's more 'convenient')
We got better, promises and later async (thanks, Maya!) made async calls almost as convenient as synchronous ones. What about isolation?
Well, good news!
Node & npm had a bat at fixing this
Having everything in a single thread/process makes you sloppy
You need modularization, isolation and asynchronous loose coupling (+synchronization)
Okay, so how big of a mess, exactly?
EcmaScript Modules has set out to fix this mess
Experimental Native ES Modules in Node 10+
It gets even better…
But…will it blend (in)?
Ever met this guy? :)
The rabbit hole goes even deeper with Electron
These lower-level abstractions are nothing new
WebAssembly one day may solve all your binary portability problems
Small, fast, portable bundles with WebAssembly + ES Modules
Fast enough to power parts of your browser!
MVP or not, Wasm is already in production
Experimentation is essential!
It's like jQuery all over again!
I'm not saying you should re-implement jQuery in the Lambda-calculus…
Tech that was once experimental, is now running purely in-browser!
Jupyter on steroids
Early standardization might help with the later head-scratching
Thinking about security early on
Experiments teach us how to improve our ways
Deno tried to learn from the permission-cataclysm
The tools might be there already
Node.js might have not had a choice 10 years ago, but the tools might already be there today. Deno is an experiment in exploring these tools.
Build your own toolbelt
“SHOULD I BE USING NODE.JS IN PRODUCTION?” —NodeConf Argentina Panel
This is is from a Node conference.
These are just tools -- use the one that fits the job, and one that you (your team, your company…) is most familiar with.
Bad news: nobody should tell you if you should use a tool. You will have to figure it out for yourself.
You don't have to know everything!
You don't have to know everything!
- You don't have to know everything
- Play early & often
- Don't be afraid to step out of your comfort zone
- Know yourself -- discover your strengths and interests
- Build a team of different strengths
- Identify problems & find the right people & tools to solve them with
Enjoy what you do!
- The ASM.js FAQ with Alon Zakai's original presentation
- WebAssembly is more than just Web - and definitely more than just the revival of Flash - articles by Steve Klabnik
- Understanding WAT, the WebAssembly Text Format - an MDN guide by Chris Mills
- A workshop-style intro to Rust+WebAssembly & wasm-bindgen by Ashley Williams & Steve Klabnik
- Hack Without Fear! — Fearless concurrency in Rust and in Servo/Firefox
- An explainer on wasm-bindgen by Alex Crichton and wasm-pack by Ashley Williams
- WebP image decoding using WebAssembly & emscripten
- Mozilla's streaming & tiered WebAssembly compilation - a blogpost by Lin Clark and V8's WebAssembly baseline compiler: Liftoff
- Nick Fitzgerald's post on embedding WASM in the devtools with Vyacheslav's response & Nick's followup
- Dan Callahan presents about WebAssembly at JSConf Budapest, runs DOS & Netscape in a browser
- DasSurma's article on WebAssemblifying Squoosh
- WASI announcement & explainer by Lin Clark