Less, but better

A presentation at Web Directions Code in June 2024 in Melbourne VIC, Australia by Ben Buchanan (200ok)

Slide 1

Slide 1

Less, but better.

Slide 2

Slide 2

“Good design is as little as possible. Less, but better. Simple as possible but not simpler.” Dieter Rams

Slide 3

Slide 3

Slide 4

Slide 4

Slide 5

Slide 5

The complexity is in our builds, not in the platform.

Slide 6

Slide 6

Zooming out

Slide 7

Slide 7

How long should our projects last?

Slide 8

Slide 8

Slide 9

Slide 9

Slide 10

Slide 10

How long should our skills last?

Slide 11

Slide 11

Vite - 1 year HTML - 28 years

Slide 12

Slide 12

Vite HTML

Slide 13

Slide 13

Bower Qunit Grunt Jasmine Gulp Webpack Jest + Enzyme Vite NTR NodeJS + NPM Selenium Nightwatch Puppeteer Playwright Cypress Python + PIP jQuery JavaScript Bash/Shell PHP CSS Server lore HTML React (class) React (func)

Slide 14

Slide 14

Bower Qunit Grunt Jasmine Gulp Webpack Jest + Enzyme Vite NTR NodeJS + NPM Selenium Nightwatch Puppeteer Playwright Cypress Python + PIP jQuery React (class) JavaScript Bash/Shell PHP CSS Server lore HTML React (func)

Slide 15

Slide 15

Bower Qunit Grunt Jasmine Gulp Webpack Jest + Enzyme Vite NTR NodeJS + NPM Selenium Nightwatch Puppeteer Playwright Cypress Python + PIP jQuery React (class) JavaScript Bash/Shell PHP CSS Server lore HTML React (func)

Slide 16

Slide 16

Bower Qunit Grunt Gulp Jasmine Webpack Jest + Enzyme Vite NTR NodeJS + NPM Selenium Nightwatch Puppeteer Playwright Cypress Python + PIP jQuery React (class) JavaScript Bash/Shell PHP CSS Server lore HTML React (func)

Slide 17

Slide 17

{} {} {} {} {} {} Storybook Elm D3 Jade/Pug Bower Qunit Grunt {} Gatsby Angular CRA Underscore Lodash Yarn Gulp Jasmine Webpack Jest + Enzyme Vite NTR NodeJS + NPM Selenium Nightwatch Puppeteer Playwright Cypress Python + PIP jQuery React (class) JavaScript Bash/Shell PHP CSS Server lore HTML React (func)

Slide 18

Slide 18

{} {} {} Fatigue Zone {} D3 Jade/Pug Qunit {} Storybook Elm Bower {} Grunt {} Gatsby Angular CRA Underscore Lodash Yarn Gulp Jasmine Webpack Jest + Enzyme Vite NTR NodeJS + NPM Stable Zone Selenium Nightwatch Puppeteer Playwright Cypress Python + PIP jQuery React (class) JavaScript Bash/Shell PHP CSS Server lore HTML React (func)

Slide 19

Slide 19

Volatility is expensive

Slide 20

Slide 20

Slide 21

Slide 21

Slide 22

Slide 22

Slide 23

Slide 23

Slide 24

Slide 24

“Nobody wants a drill. What they want is the hole.” Old sales saying

Slide 25

Slide 25

Slide 26

Slide 26

By the pricking of my thumbs, a new web era this way comes

Slide 27

Slide 27

Eras

Slide 28

Slide 28

Mid 1990s HTML Server HTML

Slide 29

Slide 29

Mid 1990s Early 2000s HTML SSR Server HTML Server HTML CSS JS

Slide 30

Slide 30

Mid 1990s Early 2000s HTML SSR Server HTML Server HTML CSS JS Mid 2000s DOM/Ajax Server HTML CSS jQuery E2E tests

Slide 31

Slide 31

Mid 1990s Early 2000s HTML SSR Server HTML Server HTML CSS JS Mid 2000s Mid 2010s DOM/Ajax Server HTML CSS jQuery E2E tests SPA Cloud infrastructure CI/CD pipelines Package managers HTML CSS Typescript React React tests E2E tests

Slide 32

Slide 32

Eras all the way down • Plugin content - Applets, Flash, Silverlight • Mobile formats - WAP, WML, iHTML, AMP • Content - broadcast, mashup, syndication, walled garden, paywall, AI

Slide 33

Slide 33

Our roles across eras

Slide 34

Slide 34

UI Frontend HTML Business Logic Backend

Slide 35

Slide 35

UI UI HTML SSR Templating (SSR) Business Logic Business Logic Frontend Frontend (in server-side languages) Backend

Slide 36

Slide 36

UI UI UI HTML SSR DOM/Ajax Templating (SSR) Templating (SSR) Business Logic Business Logic Business Logic Frontend Frontend Backend

Slide 37

Slide 37

UI UI UI UI Templating (JavaScript) Business Logic (JavaScript) HTML Business Logic SSR DOM/Ajax Templating (SSR) Templating (SSR) Business Logic Business Logic SPA Business Logic

Slide 38

Slide 38

UI Templating (JavaScript) Business Logic (JavaScript) SPA Business Logic

Slide 39

Slide 39

Frontend of the frontend GenX of frontend Backend of the frontend UI Templating (JavaScript) Business Logic (JavaScript) SPA Backend! Only backend! Nice pure backend! Business Logic

Slide 40

Slide 40

Full stack Full stack Full stack UI Templating (JavaScript) Business Logic (JavaScript) SPA Full stack Business Logic

Slide 41

Slide 41

UX & Design Content Design Tech Writer UI Frontend Business Logic in client Backend Templates on server Frontend Business Logic on server Backend Data Data

Slide 42

Slide 42

UI UI UI UI UI? Templating (JavaScript) Business Logic (JavaScript) HTML Business Logic SSR DOM/Ajax Templating (SSR) Templating (SSR) Business Logic Business Logic SPA Streamed SSR? Templating (SSR)? Business Logic Business Logic?

Slide 43

Slide 43

Every era shapes the next

Slide 44

Slide 44

Frustrations drive innovation • Repetition and low maintainability → templating, SSR, CSS • Desire for rich designs → DOM scripting, improved media and fonts • Dislike of C in CSS → CSS layers, scope, shadow DOM • Desire to escape algorithms → fediverse, cozyweb

Slide 45

Slide 45

Frameworks shape the platform • jQuery → vanilla JS features like queryselector, forEach and fetch • SASS → vanilla CSS features like custom props • CSS-in-JS → vanilla CSS features like scope, layers, and shadow DOM

Slide 46

Slide 46

Frameworks shape the platform • JavaScript → jQuery → JavaScript (ES6) • CSS → SCSS → CSS ff • Co eescript → Typescript → …?

Slide 47

Slide 47

You only get the benefit if you use the new features of the platform.

Slide 48

Slide 48

Beware of the familiarity comfort zone

Slide 49

Slide 49

My own dream of a simpler web

Slide 50

Slide 50

Quantium’s UI library

Slide 51

Slide 51

Slide 52

Slide 52

This picture is a lie.

Slide 53

Slide 53

Slide 54

Slide 54

Slide 55

Slide 55

Industry-endorsed tooling only lasted five years.

Slide 56

Slide 56

Never fear, people had suggestions!

Slide 57

Slide 57

Slide 58

Slide 58

Deno! Bun! JSR! React Test Library! PNPM! Lerna! Turborepo! Nx! Go back to Storybook!

Slide 59

Slide 59

Slide 60

Slide 60

“The definition of insanity is doing the same thing over and over again and expecting a different result.” Einstein did not actually say this

Slide 61

Slide 61

Reduce risk, add simplicity

Slide 62

Slide 62

Slide 63

Slide 63

Ten parts at 95% reliability

Slide 64

Slide 64

~40% chance of failure 0.95^10 = 0.5987

Slide 65

Slide 65

More dependencies = more risk

Slide 66

Slide 66

Dependency risks • Bad license • Breaking changes • Missing entirely • Deprecation or EOL • Package compatibility clash • Security compromised • Runtime compatibility clash • Abandonware

Slide 67

Slide 67

Not all dependencies are equal • Why use an intermediary when you can just call the CLI? • If you only use one function, why load a whole library? • Why load a whole library for minor features?

Slide 68

Slide 68

Adding simplicity

Slide 69

Slide 69

Slide 70

Slide 70

The baseline is full of features! • Shell, Node and Python scripting • NPM and PIP for packages • NPM Workspaces • NodeJS Test Runner for unit tests • Cypress for component, E2E and accessibility tests • And of course the web platform itself - HTML, CSS, JS

Slide 71

Slide 71

Principles • Use as little as possible • Choose native where possible • Make unproven technology as fungible as possible

Slide 72

Slide 72

Hard “no” • Powershell • Yarn, Webpack, Gulp, Babel • Monorepo tools • Intermediary libraries • React-speci c test frameworks fi • Gatsby

Slide 73

Slide 73

Additions • Vite for docs and React test xtures • SCSS for our design token integration • STMUX to run things in parallel • onchange for hot reloading fi • Plus the actual executables like SASS, Stylelint, etc

Slide 74

Slide 74

/ /apps /dashtest /docs /reacttest /packages /core /dash /react /tests

Slide 75

Slide 75

Remaining complexity • I really wish NPM run would build in a watcher • Extracting TS de nitions remains disappointingly di cult • SCSS may still go, we barely need it • Github Actions is intrusive, we may push more to shell scripts ffi fi • Building Dash is a bit niche and strange, but probably not of concern to many

Slide 76

Slide 76

So… do we like it?

Slide 77

Slide 77

• 5610 dependencies (!!!) • 1525 dependencies (-72%) • ~5-10 minute rst-time setup • ~2-3 minute rst-time setup (-70%) • ~1-2 minutes to start • ~25-30 seconds to start (-50%) fi After fi Before

Slide 78

Slide 78

Less, but better. • 72% less dependencies • All existing functionality maintained • 70% less build time • New components added • 50% less start time • Massively improved test coverage

Slide 79

Slide 79

Best of all… Contributors no longer waste hours getting the project to run. ff They ship work that makes a di erence to customers.

Slide 80

Slide 80

What’s next?

Slide 81

Slide 81

React API Dash API Angular API Dash Templates Angular Templates React Tests React Templates CSS & HTML patterns

Slide 82

Slide 82

Vue! React API HTMX! Rshiny! Dash API Angular API Dash Templates Angular Templates React Tests React Templates CSS & HTML patterns Svelte! Streamlit! Web components?

Slide 83

Slide 83

You’ll never guess which new and shiny thing I proposed!

Slide 84

Slide 84

Slide 85

Slide 85

A business case for web components

Slide 86

Slide 86

Slide 87

Slide 87

Slide 88

Slide 88

Considerations for tech choices • Strength of solution and its ecosystem • Security and licensing • Cost to buy • Cost to migrate/roll out • Cost to maintain • Cost of training • Impacts to hiring and onboarding • …and how long before you ask me to approve all of this all over again?

Slide 89

Slide 89

Web components • Ecosystem - the web ✅ You can keep your current framework. • License - free ✅ You can support multiple frameworks. • Migration - incremental ✅ This choice is the lowest risk you can o er to build and maintain a UI layer. fi ff • Longevity - possibly inde nite ✅

Slide 90

Slide 90

React API Dash API Angular API NewShiny API React Tests Dash Tests Angular Tests NewShiny Tests React Templates Dash Templates Angular Templates NewShiny Templates CSS & HTML patterns

Slide 91

Slide 91

React API Dash API Angular API Web Component tests Web Components CSS & HTML patterns NewShiny API

Slide 92

Slide 92

Framework API Framework API Framework Tests Framework Tests Web Component Tests Framework Templates Framework Templates Web Components CSS & HTML patterns Framework API Framework API CSS & HTML patterns

Slide 93

Slide 93

Framework SPA Framework API Framework Component Web Components

Slide 94

Slide 94

Mid 1990s Early 2000s HTML SSR Mid 2000s Mid 2010s DOM/Ajax Mid 2020s SPA Native web?

Slide 95

Slide 95

Slide 96

Slide 96

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” Antoine de Saint-Exupéry

Slide 97

Slide 97

Less, but better. Ben Buchanan / 200ok.blog / @200ok@mastodon.social