4 ms·
HTML with a tiny bit of JavaScript is just considered not an option at all, by the designers and the business. They don't want a HTML form post when you delete
by Touche 6y ago
HTML with a tiny bit of JavaScript is just considered not an option at all, by the designers and the business. They don't want a HTML form post when you delete an item from a list, they want the item to animate out. So if you look at it like that, then yeah it is probably more developer efficient to do it the modern way.
- simonw 6y agoThat's the tiny-bit-of-JavaScript-enhancement. It's trivially easy to hook up a "delete" button such that it works without JavaScript, but if JavaScript is available it turns into a fetch() POST that removes the item (with a CSS animation) once it completes. Or if you're too lazy for progressive enhancement, you can skip the "works without JavaScript" bit. I used to do this kind of thing with jQuery one-liners all the time. Today browser compatibility is good enough that you don't even need jQuery.
- Touche 6y agoYeah but requirements are never that simple. You also have a cart item in the header that shows 4 but now must show 3, and you have a price that's over in the sidebar that needs to update, etc. Oh and the user is logged in and is receiving a notification that an item they were watching is now available, better show a toast. Sorry but the simple jQuery sites turn into soup once the requirements are what they are today. You can still do it, it's possible, it becomes harder and harder to maintain long-term though. Then efficiency becomes worse than how people do it today.
- simonw 6y agoSo many of the projects I've seen built with modern JavaScript aren't nearly that complicated though. They're building in anticipation of that complexity, but it never arrives. Look at how many content-oriented news website article pages have gone all-in on React, with the result that they serve up over 1MB of JavaScript just to show you an article with a "save" button that no-one ever clicks.
- Touche 6y agoThis is very true. I think, as this article describes, going through the process of discussing priorities as part of the initial architecture would lead to asking the questions about what the requirements really are, and what technologies best fit those requirements.
- simonw 6y agoYes, definitely. There are plenty of applications that benefit enormously from the modern JavaScript stack. I wouldn't dream of attempting something like Trello without React or similar! But I don't think it should be the default for every project without at least some careful thought.
- kethinov 6y agoI laughed when you said Trello because I just got done speaking with a colleague who complained that it locks up on her every time she tries to screen share while using it; the only web app she works with where she has this experience. It's obvious that the over-reliance on JavaScript is the reason for this and if Trello had a non-JS option she would surely take it even if the UX was "worse." (What could be worse than the UI freezing constantly?)
- potta_coffee 6y agoAlso as soon as you provide something nice, the manager or business owner or whoever is going to ask for a dozen more features and then you realize "doh, it'd be nice to have some way of organizing all this spaghetti".