Write less, do more with Svelte

- Posted in development javascript svelte

A few days ago I watched Rich Harris’s talk at JSCamp. It offers a different perspective on Svelte than the talk I usually recommend when learning about Svelte – which is called Rethinking Reactivity.

This talk is focussed on the idea “write less, do more” which was jQuery’s tagline.

Rich Harris says that one of the benefits of Svelte is writing less code. Because code is terse there is less boilerplate, which leads to less bugs. It also makes code more understandable. As a reader you have to follow less code paths and more code is visible on a single screen without scrolling. This leads to a better understanding.

Svelte is fast and the developer experience is excellent – but every framework claims this.

Rich realised that the unique part about Svelte’s compiler based approach is that it expands the problem space the framework can operate in.

Since it’s a compiler, it can do more, in theory the compiler can grow larger as long as the bundle sizes it generates stay small.

This offers possibilities such as code linting without bringing in another dependency. For example, Svelte warns when using the autofocus attribute on form fields because it is generally advised against, because it causes accessibility issues.

What about the “do more” part? Anyone who has learned jQuery might remember how easy it was to fade something in and out. Suddenly something that was out of your grasp before, you were now able to do. jQuery-based code has gotten a lot of criticism over the past years but let’s not forget that it was many developers’ superpower for a long time. 

Taking things back to Svelte, I have a similar feeling. I’ve never been a hardcore developer. But Svelte enables me to make things that I previously could not do. Rich talks about where he wants Svelte to go – he wants to bring more people to the web, make coding interactive experiences more accessible instead of leaving it only to those who happen to very skilled at blindly manipulating symbols.

As for me, I want to do the same. I think web development shouldn’t be as hard as we tend to make it. There is a lot of overengineering in code out there. From a community perspective there is a lot of gatekeeping. Think “you are not a real developer if…”.

I remember when I got a computer and started tinkering with creative apps and later with HTML and CSS. I never got it until someone explained it well. Through reading many resources and being in the field for years I know what I know now; at the same time I feel the path should be easier. 

We should break barriers and enable everyone to create. I can totally behind a framework like Svelte which is first of all just a great framework but secondly, where the original author has lofty goals that I can stand behind.

If you are interested in Svelte, I am organising an event on March 13th in a new Meetup group called Svelte Society Belgium.

It will be a code-along where we will code a small application together. There are not that many spots, so make sure to register! You can register using this link.

Leave a Reply

Your email address will not be published. Required fields are marked *