Most active commenters
  • pier25(7)
  • thunky(6)
  • lmm(5)
  • WD-42(4)
  • klysm(3)

←back to thread

260 points gherkinnn | 54 comments | | HN request time: 3.26s | source | bottom
1. pier25 ◴[] No.42164501[source]
> I like to argue that some of the most productive days of the web were the PHP and JQuery spaghetti days

I've wondered if going back to that paradigm would be more productive or not than using React et al.

Plenty of big sites like Amazon or Steam still are made this way. Not exactly PHP + jQuery but rendering HTML on the server and sprinkling some JS on top of it.

Has anyone gone back to working like that?

replies(13): >>42164565 #>>42164636 #>>42164646 #>>42164666 #>>42164714 #>>42164722 #>>42164754 #>>42164840 #>>42164957 #>>42165180 #>>42166069 #>>42169495 #>>42169508 #
2. the__alchemist ◴[] No.42164565[source]
I use this general approach in most cased.
3. WD-42 ◴[] No.42164636[source]
I just finished migrating a fairly large legacy vue2 app to server side rendering and HTMX. Its thousands of lines less code and also hundreds if not thousands less dependencies. Most importantly I’m not worried about the tech stack becoming abandoned and un updatable in 5 years like vue2 was.

There are some pages that require more local state. Alpine.js has been great. It’s like Vuejs that you can initialize on your page and doesn’t require a build step.

replies(1): >>42167634 #
4. tobinfekkes ◴[] No.42164646[source]
Yes, this is 100% of my work.
5. RadiozRadioz ◴[] No.42164666[source]
I've found that to be the case for my personal projects. Not less for the fact that I don't have to spend any time googling anything. I can just write code. I've used web tech for so many years that I don't need to learn anything anymore if I'm not in a framework. Outside a framework, it's all just the same stuff that's always been there.

Even today's LLM-assisted programming doesn't give me that fluidity. If I use LLMs to assist me in writing a big framework, it'll autocomplete stuff I haven't learned yet, so I need to retroactively research it to understand it.

JS soup on a webpage is a mess, but it's all using the same tools that I know well, and that to me is productive.

6. gausswho ◴[] No.42164714[source]
Steam has largely abandoned it in favor of React in their big facelift a couple years ago.
replies(1): >>42164912 #
7. educasean ◴[] No.42164722[source]
I think the old way works well for a smaller scale app that doesn't need to change often. Otherwise, I find the components-based code reuse to be a pretty valuable pattern, especially when working as a team.
replies(2): >>42164905 #>>42165158 #
8. bitnasty ◴[] No.42164754[source]
Not sure if this counts as “going back” but I have been managing a legacy project that is built like this for the past year or two. I hated it at first, but now I’m starting to appreciate it. My approach is to try to put as much as possible in php, but for parts of the page that are going to be manipulated by js/jquery, just have php pass the data as json and build that portion of the dom on the front end.
9. scrollaway ◴[] No.42164840[source]
It’s really not more productive.

Working with react has a higher barrier of entry (something which is becoming less true over time given that many templates etc exist for it), but if you want to be producing pages and functionality, a good react dev will run leagues around even an a exceptionally good jquery dev.

I’m solid at both and we are talking a dev cycle that is magnitudes faster once you are set up reasonably well. There’s a reason it’s popular. Typescript makes a lot of testing unnecessary and gives many guarantees on robustness. React makes it a breeze to create complex state full components. Nextjs makes it super easy to deploy all this to a web app and quickly create new pages.

replies(2): >>42164893 #>>42164963 #
10. pier25 ◴[] No.42164893[source]
> a good react dev will run leagues around even an a exceptionally good jquery dev

It probably depends on the use case, no?

If you only need links, forms, and data tables what advantage does React have over SSR + jQuery?

replies(2): >>42164987 #>>42166351 #
11. wild_egg ◴[] No.42164905[source]
There's no reason at all why you can't also organise code into components under this model. Orthogonal concepts
12. pier25 ◴[] No.42164912[source]
You mean the Steam client or the store?

I was referring to the store. Just checked it and there's tons of jQuery and vanilla stuff (at least on the homepage).

replies(1): >>42172405 #
13. lelanthran ◴[] No.42164957[source]
It depends.

A shopping site or similar, then sure - the "one thing at a time " workflow works.

For internal line of business apps? I'm not sure sure anymore. From a comment of mine a few days ago: https://news.ycombinator.com/item?id=42148627

> Which is a pity; I was watching a client do some crud work in a webapp.

> Web - 1 form per page:

> Click "back". Copy some text. Click forward. Paste it. Repeat for 3 different fields. Click submit.

> Native apps (VB/Delphi/etc) used to be:

> Open both forms. Copy and paste from one to the other. Open another one on the side to lookup some information, etc.

> Webapps, even moreso with MPA, force a wizard-style interface - you only go forward through the form. This is not how people used to work; they would frequently have multiple forms in the same app open at the same time.

> With SPA and html "windows" made out of movable divs you can probably support multiple forms open at the same time, but who does that?

replies(1): >>42167494 #
14. swatcoder ◴[] No.42164963[source]
For as much as you're right, your taking a very narrow short-term view of productivity.

The maintenance demands for using a heavy, evolving framework and a large graph of churning dependencies are tremendous and perpetual. While you can make meaningful wins on delivery time for a new feature, once "you are set up reasonably well", you've impliclty introduced new costs that don't apply to "vanilla" code that stays closer to established standards and only includes code it actually uses.

That's not to argue that vanilla is strictly better (both have a place), but just to acknowledge a latent but significant tradeoff that your comment seems to ignore.

replies(3): >>42165266 #>>42166551 #>>42171907 #
15. morbicer ◴[] No.42164987{3}[source]
Non-spaghetti dynamic forms and their validation (yes you need to validate on server as well).

Reusable components that can be tested in isolation. Type support. That leads to easier evolution and refactoring.

With good architecture you can go mobile with react-native.

replies(1): >>42165121 #
16. pier25 ◴[] No.42165121{4}[source]
Most modern backend frameworks provide components, types, and validation.

Laravel, Dotnet, Rails, etc.

17. pier25 ◴[] No.42165158[source]
Most (if not all) backend frameworks provide components these days.

See Laravel, Dotnet, Rails, etc.

18. dacryn ◴[] No.42165180[source]
we more or less do for all the applications in my team, which don't follow the corporate standard.

They're all Django applications, and the limited dynamic elements are just simple jquery. We have some bootstrap stuff and elements like form elements in javascript, but that's about it.

We are extremely productive, especially compared to our official apps which follow the .NET/Angular stack, that run into all kinds of API versioning issues and errors, it's not even a faster user experience. The problem with such a stack is that you need a few highly skilled architects/system designers. We just have regular programmers piecing it all together, most of them learned these frameworks on the job and come from a regular app dev background, not web.

Granted, we only serve something like 20-30 concurrent users for each of tthe Django apps (as in, page requests/second), but still...

19. pier25 ◴[] No.42165266{3}[source]
> and a large graph of churning dependencies are tremendous and perpetual

Absolutely. This the reason I'm moving on from JS in the backend. You're constantly stitching up dependencies which might be abandoned and/or become incompatible at any moment.

20. kukkeliskuu ◴[] No.42166069[source]
I am have several side projects, and they mostly follow this pattern. For one app, I developed around 100 views (plus the admin views) in Django in just a few months, I could have never done it if I was using a "modern" stack. In many applications most pages (login, registration, logout, entering data etc.) can be built using traditional server-side rendered HTML forms with a little Javascript sprinkled on top, and most of the JS can be handled by Alpine.js. For the pages that need more interactivity, I use HTMX and Alpine.js. It works really well.
21. klysm ◴[] No.42166351{3}[source]
Composabilty and abstraction. I can bang out a react form in our app in minutes just by defining the shape of the fields. All the loading states are handled automatically. Mutations and refreshing data works out of the box. Navigating between pages is instant. Data is cached even when navigating between pages. Some pages that require many user inputs utilize optimistic updates to afford very low latency feedback.

React makes all of that easy to compose. I tell it how to render my state, and I write code that updates state.

replies(2): >>42168427 #>>42170630 #
22. whstl ◴[] No.42166551{3}[source]
> The maintenance demands for using a heavy, evolving framework and a large graph of churning dependencies are tremendous and perpetual

Counterpoint: If you replace a frontend framework with backend components, as has been suggested a few times in this thread, those frameworks are even larger, and a lot of the basic functionality provided by React (such as components) is often provided by third-party packages.

Sure, if you're using something like jQuery, then it's smaller and more stable, but the functionality is limited compared to both backend and frontend frameworks. Which of course might be 100% appropriate depending on the use case.

23. tacticus ◴[] No.42167494[source]
IMO MPA apps that don't break the back page and support multiple tabs and windows are far easier to have the side by side comparison model than SPAs which get fun dom nonsense the moment you try and do something the dev didn't precisely expect.
replies(1): >>42169494 #
24. Jaygles ◴[] No.42167634[source]
How much of that code and dependency reduction is due to having the entire app to use as a spec? How can you be so sure this new stack won't be "abandoned"? (Vue has received regular updates for 11 years)
replies(2): >>42168404 #>>42169567 #
25. WD-42 ◴[] No.42168404{3}[source]
Vue 2.x is NOT receiving updates. Not even security updates. Its abandonware.

I had to ask myself if it was worth the hassle to update to 3.x and risk the same thing happening again. The answer was no.

The new stack is Django (which the backend was already written in). Will it stop receiving updates? Extremely unlikely, conserving they have been preserving upgrade paths for the last 20 years and has a solid foundation supporting it.

The supporting ui libraries like htmx and alpine could conceivably become abandoned. The big difference is that they can be vendored easily.

I checked the vue project and it has 1500 transitive dependencies. The new “stack” has a whopping total of 7.

On top of that there is no build step to maintain. Also it’s straight up way faster.

replies(2): >>42168897 #>>42168952 #
26. thunky ◴[] No.42168427{4}[source]
> Composabilty and abstraction

Also possible without react with far less complexity.

replies(2): >>42168835 #>>42169115 #
27. lmm ◴[] No.42168835{5}[source]
It really isn't, unless you go full server-side session (with something like Wicket), and the latency of that is usually unacceptable these days.
replies(1): >>42172139 #
28. pier25 ◴[] No.42168897{4}[source]
> Vue 2.x is NOT receiving updates. Not even security updates. Its abandonware.

I algo got burned with Vue 2 at one point. Pretty amazing considering Vue is quite popular. Recently went over 1M daily downloads.

https://npm-stat.com/charts.html?package=vue

I don't think even jQuery had so many downloads back in its heyday but it has maintained its API and methodology after all these years.

replies(1): >>42169492 #
29. recursivedoubts ◴[] No.42168952{4}[source]
htmx will not be abandoned as long as I'm alive, and the API will not change significantly either

i am hoping my oldest son gets interested in computer programming and can take over as the lead eventually

replies(4): >>42169010 #>>42169316 #>>42169612 #>>42170163 #
30. kelnos ◴[] No.42169010{5}[source]
I haven't done any real web development in over 20 years, but will soon have to build some sort of dynamic web site. I toyed with React 8 or 9 years ago (though never did anything with it, really), and found everything out there to be large and clunky and difficult to work with.

I came across htmx a while back and have kept it in the back of my mind as something to potentially use if I ever had to build something. I'm glad this article came up on HN, and your comment here... makes me really want to build something with htmx!

31. klysm ◴[] No.42169115{5}[source]
I’ll believe it when I see it. I’ve used many many different UI frameworks, and react works the best out of all of them that I’ve tried.
32. WD-42 ◴[] No.42169316{5}[source]
Hey! Whether your son takes over or not, the larger point I was trying to make is that worst case I can vendor htmx.js with my app and keep it going for a long, long time.

Same can’t be said for the vue app and its 1500 dependencies + web pack build chain. At least not as easily.

33. WD-42 ◴[] No.42169492{5}[source]
I think npm stats aren’t even the same thing as number of jquery downloads. I bet 99% of the downloads off npm are automated jobs like CI.
34. lelanthran ◴[] No.42169494{3}[source]
Broadly, I'm in agreement.

But the folks using the company's line-of-business apps mostly aren't even aware that the browser can open a particular part of the app in a new tab, and even when they are, they aren't aware that the tabs can be torn off into separate windows, and of those that do, there are still some who wouldn't figure out that both browser windows can be tiled side-by-side.

And even when you pass all those hurdles, it's still disruptive enough to the normal workflow that most people who can do that won't do it at all anyway.

35. wwweston ◴[] No.42169495[source]
I tacked that direction after my work with early Angular and React sites 2014-2016. It isn’t that I’d never work on an SPA or a site using front-end frameworks like that, it’s that it became very clear to me quickly that they weren’t necessary or particularly helpful for the majority of the sites they were used on (definitely including the sites I was working on, one of which was thrown away entirely months after we delivered it to the client), and how much adoption was resume driven.

I used to assume React solved genuine problems for FB but given ways in which the UX+performance has gotten worse, I’m not even sure about that.

Meanwhile html plus progressive enhancement works fine for the majority of projects I’ve been involved in. Componentization can still be a win but there’s other ways to do it.

36. nicbou ◴[] No.42169508[source]
This is how I work. My website is content enhanced with calculators and other widgets. The widgets are individual Vue apps contained within bits of Jinja templates.

The backend is an API for the contact forms and the feedback collection forms.

37. ecshafer ◴[] No.42169567{3}[source]
Not OP, and this was Hotwire Rails with Stimulus but I also saw a similar reduction in moving a page from React to Hotwire. It was actually a new page, with significant changes so couldn't be trumped up to just a rewrite. But this was easily 1/10th if not more of a reduction in LOC than the similar React app it was replacing, with the more features, and a like a 90% increase in performance.
38. grugroyal ◴[] No.42169612{5}[source]
Primogeniture is an underrated project leadership policy.

You will need a Latin motto on your coat of arms. Something like "Simplex sigillum veri".

replies(1): >>42186080 #
39. throwup238 ◴[] No.42170163{5}[source]
> i am hoping my oldest son gets interested in computer programming and can take over as the lead eventually

Sacrificing the first born as god intended.

40. Zanfa ◴[] No.42170630{4}[source]
On the other hand, using React means you'll have a 2nd source of state (form & navigation at the very least) that needs to be maintained and tested for edge cases. Everything needs to be validated 2x, since you can't trust anything coming from a client anyway. Correct state management between page navigations is definitely not something you get for free judging from the number of broken React SPAs where you can't properly use multiple tabs or other browser mechanisms.
replies(1): >>42179951 #
41. imtringued ◴[] No.42171907{3}[source]
I'm still working on a project that uses jQuery in 2024 and it is a horribly bad fit and maintenance nightmare. I would prefer predictable new costs over random global effects in combination with duplicated server-side and client-side code that can blow up at any time.
42. thunky ◴[] No.42172139{6}[source]
I think you and the sibling may have missed the requirements up thread:

If you only need links, forms, and data tables

replies(1): >>42178685 #
43. tpxl ◴[] No.42172405{3}[source]
The steam client is a web browser displaying the web page, with a few additional things (like installing games and such).
44. lmm ◴[] No.42178685{7}[source]
In my experience even something you thought was a basic form will usually have some kind of UI state (e.g. one input that then enables/disables another input).
replies(1): >>42179626 #
45. thunky ◴[] No.42179626{8}[source]
Can't that be done in one or two lines of jQuery?
replies(1): >>42179903 #
46. lmm ◴[] No.42179903{9}[source]
Yes, of course. And then you add one or two more lines of jQuery. And then another few lines to deal with the client-side and server-side state getting out of sync. And then...

Is putting in a couple of lines of JS that has no knowledge of the backend-managed good enough for small one-off pages? Maybe. But it's definitely not composable and abstractable, which was the original claim.

replies(1): >>42183510 #
47. klysm ◴[] No.42179951{5}[source]
The libraries I use give it to me for free
48. thunky ◴[] No.42183510{10}[source]
I assume we're still talking about links, forms, and data tables. If the forms are so complex that we need React to manage them then it may be worth trying to simplify them a bit first.

Or if the forms have to sync with the backend then there are other React-less options, for example:

https://htmx.org/examples/value-select/

replies(1): >>42189602 #
49. recursivedoubts ◴[] No.42186080{6}[source]
nemo codeo appendium lacessit
50. lmm ◴[] No.42189602{11}[source]
> If the forms are so complex that we need React to manage them then it may be worth trying to simplify them a bit first.

Some forms are simple enough that you don't need composition and abstraction, yes, no-one's denying that.

> Or if the forms have to sync with the backend then there are other React-less options, for example:

> https://htmx.org/examples/value-select/

Ok, now try composing that. What happens when you want to nest one of those inside another (i.e. have 3 levels of selection)?

replies(1): >>42193954 #
51. thunky ◴[] No.42193954{12}[source]
The forms/inputs are composable on the backend where the state is managed and the html is produced.

Here's the most dynamic form I can think of: https://www.globalgolf.com/golf-clubs/1064148-titleist-tsr2-...

Any input change triggers any/all other inputs to change.

Looks like they send the entire page each action, no React, yet the user experience is much better than the typical competitor site where they've overengineered the whole front end.

Their faceted search is nice too: https://www.globalgolf.com/golf-clubs/used/titleist/fairway-...

Notice how when you add a filter it updates the URL. Breath of fresh air.

And this is way beyond what I had in mind when I read links, forms, and data tables.

replies(1): >>42199963 #
52. lmm ◴[] No.42199963{13}[source]
I clicked a couple of inputs and it's now stuck on a loading animation of a glass getting filled with golf balls (been running for about two minutes now). So you've pretty much proven my point.
replies(1): >>42200535 #
53. thunky ◴[] No.42200535{14}[source]
Oh no...

Welp guess I'll have to take my business elsewhere. Thanks for the heads up.

Now I'm off to find a golf site that uses React for guaranteed perfection.

replies(1): >>42209437 #
54. scrollaway ◴[] No.42209437{15}[source]
As a third party to this conversation, I think it's completely hilarious that you try really hard to make a point that ends up proven wrong, and your answer, rather than actual introspection about your beliefs, is sarcasm and an overall rude response.

This stubbornly stupid mindset is why we have wars.

Edit: I checked the site myself and was able to reproduce the issue mentioned in GP. This is a terrible website.