Frontend isn't hard (anymore)

Complaining about the difficult about frontend is an easy way to garner agreement among programmers. The complaints fall into a few buckets:

  • JavaScript is a terrible language
  • There are too many choices
  • The ecosystem is constantly shifting
  • A project from a year ago can no longer be built
  • It’s too bloated or complicated

Much of this criticism was valid, but I don’t think it reflects the state of frontend today.

JavaScript is a terrible language

JavaScript is a language everyone loves to hate on. This is made even more frustrating since there isn’t any real alternative to JavaScript for client-side scripting.

JavaScript is a confusing language. It’s single-threaded and nobody knows how this works. There are significant differences when running JavaScript in a browser compared to NodeJS.

A lot of this frustration comes down to not understanding how JavaScript works. Investing in properly learning JavaScript pays dividends. A few key concepts will demystify much of the language.

One of my biggest complaints of JavaScript is the lack of static typing. This is resolved with TypeScript which has become one of my favorite languages. Libaries today almost always have excellent types and TypeScript itself has a type system more powerful than more mainstream languages.

There are too many choices

  • Cient-side or server-side app
  • MPA or SPA
  • SSR or CSR
  • npm or yarn or pnpm
  • NodeJS or Deno or Bun
  • eslint + prettier
  • ESM or AMD or
  • How do I deploy my site?
  • Bundler
  • Jest or Vitest

I feel this is a completely unfair criticism of frontend. Yes, there are a lot of choices to make. The reality is that you’ll have similar choices when writing any other kind of app. For example, if you’re writing a backend app you have to decide:

  • Database: sqlite, MySQL, MongoDB, DynamoDB
  • ORM: Bespoke or some framework
  • Hosting: VPS, K8s, serverless
  • Language: Java, Go, Rust, Haskell
  • Logging and monitoring
  • Backups
  • Routing framework

The ecosystem is constantly shifting

When writing a frontend application you need to make two core choices: how are you going to bundle your code for a browser and what library are you going to use.

There are so many choices for frontend libraries and it can feel like thery become obsolete faster than they can be learned.

The reality is that React has been dominant for years. The biggest shift in the landscape has been the move from classes to hooks. If you learned React in 2013 then the core of your knowledge would still be relevant today.

Bundlers have a similar story. Webpack was released in 2014 and has been dominant up until recently — it’s slowly being replaced by Vite. Vite significantly simplifies bundling and is better than Webpack in every way.

A project from a year ago can no longer be built

Frontend in 2024

For a new project in 2024, you’d do very well with just Vite and React. If you wanted something more cutting edge then you could try out Astro.

Recent posts from blogs that I like

Painting poetry: John Keats

Paintings based on Endymion, The Eve of St. Agnes, and La Belle Dame Sans Merci, mainly from the Pre-Raphaelites.

via The Eclectic Light Company

Live blog: the 12th day of OpenAI - "Early evals for OpenAI o3"

via Simon Willison

Turing Machines

body { text-wrap: pretty; } @media (prefers-reduced-motion: reduce) { * { transition: none; animation: none; } } turing-machine { width: 100%; display: block; position: relative; padding-bottom: 1em; } turing-machine .program-container { position: relative; display: flex; justify-content: center; } ...

via Sam Rose