net - UK (2020-01)

(Antfer) #1

Interview


still we recreate a lot of it with JavaScript.
Rather than using dependencies or
libraries, use HTML, CSS and native
JavaScript methods and browser APIs –
vanilla JavaScript – whenever you can.”
Secondly, instead of reaching for large
multipurpose tools, Ferdinandi
recommends using small, modular tools
that do just one thing well. “We tend to
go for the pocket knife that does 24
different things but maybe all we need is
a pair of scissors. For example, instead of
downloading all 27 kilobytes of Lodash,
when you only need one or two helper
functions, you can extract those or use a
small helper function that does exactly
the same thing at a fraction of the size.
There are also some substantially smaller
alternatives to frameworks like React and
Vue that shed a lot of the tools that were
designed for Facebook- and Twitter-sized
apps. Svelte comes to mind or Preact,

which uses the same API as React, but is
only three instead of 30 kilobytes.”
The final principle is remembering that
the web is for everyone. Ferdinandi points
out that we break experiences when we
only focus on the latest browsers and
devices and neglect to take into account
users on lower incomes, slower networks
and those with diverse abilities.
To prove that some well-known
companies actually build sites and apps
the ‘lean web way’, Ferdinandi maintains
a list of organisations at vanillaJSlist.com.
“GitHub removed jQuery from their app
last year,” Ferdinandi explains. “Instead
of replacing it with a modern framework,
they opted for native browser methods
and custom web components. Internally,
they have a motto to build websites like
it’s 2005, so whether you have JavaScript
turned off, it fails or you’re on a slow
connection, you can still perform all the

ethos of the term ‘the lean web’ – coined
by Thomas Fuchs – resonated with him
and so he started compiling his thoughts
into a central resource. “The Lean Web is
an approach to web development that
focuses on simplicity, performance and
the user over the developer experience,”
he explains. “In many ways, it’s a little
bit like becoming a developer dinosaur:
you’re going to end up relying on some
older techniques and maybe chasing the
bright and shiny stuff less. I’m not saying
you should never use new techniques but
I want to encourage folks to be a little bit
more thoughtful about the tools they use
and why.”
Ferdinandi summarises The Lean Web
with three principles. The first one is to
embrace the platform and everything it
provides out of the box. “Modern browsers
are incredibly capable tools,” Ferdinandi
says. “They give you so much for free and


Fe

rd

in
an

di
sp

ea

ki
ng

at

A

rti

fa

ct^

-^
Ph


ot
o^ C

hr

is^

Ca

sc

ian

o^ (

ht

tp

s:/

/p

lac

en

am

eh

er

e.c

om

)
Free download pdf