Let's stop arguing about JavaScript frameworks

A developer surrounded by intimidating figures. Image from Pixabay

JavaScript frameworks are the subject of much debate in the frontend community. Are they good? Are they bad? Should we use them?

I keep having this conversation and I've stopped enjoying it so I'm just going to write down what I think.

Background

First a bit of context, so you know where I'm coming from.

I've used JavaScript frameworks in the past, but it's been a while since I've had any hands on experience. I definitely wouldn't call myself an expert. Apart from an internal site I built for my last company in React I've mainly used JS frameworks for small personal projects that are mostly unfinished.

I quite enjoyed working with Angular, because of the way it allowed me to insert dynamic elements into existing markup. This was a long time ago though, and my understanding is that Angular is quite different now.

I used to be a bit anti-React because of my experiences in a previous job. I worked with someone whose immediate response to any problem was "you should have used React". Unfortunately their zeal spread to other members of the team, and the result was a lot of over-engineering.

I don't use JS frameworks in my current job. GOV.UK has a lot of JavaScript, but most of it is to do small things in the UI (like expanding and collapsing elements) or for analytics purposes. Even if we wanted to introduce a JS framework there's not really any need for it - most of our content is static pages.

That's enough about me. Let's talk about JS frameworks.

For

JS frameworks are amazing. They allow developers to produce incredibly complex sites by providing a mechanism for dynamic page updates based on state changes. They allow sites to be built rapidly and remove the massive complexity that would normally be involved in updating the frontend. They can save hours of development time and many lines of code.

They should be used for everything.

Against

JS frameworks are terrible. They immediately add huge bloat to the download size of websites, which is bad for the user experience. They distance developers from the frontend code, which often leads to poor accessibility. They're often used by developers who are skilled coders but not very knowledgeable about how to properly structure a semantic site. They're often used where they aren't needed.

They shouldn't be used for anything.

Actual problems and other arguments

Hopefully the above sums up both the valid pros and cons of JS frameworks and also the extreme opinions that some people seem to have about them.

As time has passed I've come to care less about this argument. The best approach to any web development project is to look at the requirements, the time and the team available, and decide what the right thing is for where you are right now.

Yes, if you've got a team of Vue.js developers then you'll be able to build something quicker with the technology you're familiar with. And building an SPA without a JS framework is a laborious process. But is what you're building actually an SPA?

Yes, JS frameworks can add page weight to a site's download size, but sometimes this is a price worth paying, and there are ways to mitigate the problem. Most of the slow sites I've encountered have been due to uncompressed images; the worst offenders are sites where speed hasn't been considered at all, and the JS framework size is but one of a number of problems.

Yes, JS frameworks can attract backend developers to building frontend, and they don't always consider accessibility and semantics, but this is an awareness and training problem, not a technical one. I like it when backend developers express an interest in what I do and I like explaining how it works. I think each discipline has things to learn from the other, and collaboration is the best way forward.

Yes, frontend development is now such a broad and complicated field that recruiting someone to a specific role can be difficult, and it might be several steps through the interview process before you discover that a candidate doesn't have exactly the required skills. But that can be fixed too - with more specific job specs, better interview questions and new starter training.

TL;DR

Like many things these days the main problem is that everyone seems to be so polarised over this argument. The only question that matters at the end of the day is: what's the right tool for the job?

And show me a React developer who'd be lost if they couldn't use their framework but is willing to learn, and I'll show you someone who can be taught everything else they need to know.

Related

This article is tagged with