News for hackers. Stuff that matters.
Re:MVC frameworks aren't dinosaurs but sharks by mod on Monday May 09, 2022 @03:03PM (#31318340)
> Last years, using MVC framework was not an option as soon as you wanted a dynamic front-end. Having to reload a full page for every user action leads to a bad user experience and is indeed, not acceptable in 2022.

When it's needed, fine.

But there are so many SPAs that just don't need to be. Rendering HTML server-side is just nice. It's simple and easy to work with. Weird states are unusual. The user gets a really normalized, predictable experience. And done well/quickly, there's little actual difference.

Maybe I'm just showing my age. This falls really close to my "I miss the old web" type sentiments. The last thing I built, and the next thing I will build, are purposely doing full page renders for any actions (no jQuery or React/SPA stuff). I don't think I'm going to have any javascript at all. It's really fun and lean. I don't know, it's just got me going lately--reminds me of when I was starting out.

My last project is 300 lines of python, 270 lines of php, html/css of course, postgresql, and cron. Some scrapers run, ingest data, and the php sorts and displays it.

Re:MVC frameworks aren't dinosaurs but sharks by mmcnl on Monday May 09, 2022 @05:18PM (#31319889)
Rendering server-side HTML is fine, as long as your application is stateless. Then it's really easy. However, when your application becomes more interactive and thus state-driven, is it really easier to it server-side? Remember, the primary function of modern frameworks is to have a declarative way of creating your by writing it as a function of state. Things get messy really quickly once you start to build something more complex.

Also, is it really easier to everything on the server? I don't think it is so by definition. You could argue that a stateless REST API with client-side state management is less complex than doing everything server-side. It's a much more scalable solution and creating interactive user interfaces is very easy.

Ofcourse it could be that interactive user interfaces is not something you are aiming for. That's fine. But do understand that most applications are actually usually very interactive.

Re:MVC frameworks aren't dinosaurs but sharks by mattmanser on Monday May 09, 2022 @05:50PM (#31320256)
Yes, it is. That's what databases and POST data is for and it's all incredibly quick.

Almost all applications that are written in the world today are glorified forms.

That's reality because 95% of apps are written for the business world. Most don't really do much apart from take some form data, apply business logic to it and show the results/send some messages.

Even most consumer apps like Facebook/Twitter/TikTok/Pintrest/etc. are basically glorified forms.

You can do save/load state all in nanoseconds, any competent programmer can easily aim for 50ms page loads, well under human detection.

This is incredibly basic stuff and how it was done for decades before SPAs.

Re:MVC frameworks aren't dinosaurs but sharks by feoren on Monday May 09, 2022 @06:12PM (#31320510)
You have rose-colored classes for the past. Multiple-megabyte state cookies were very common in business applications written in .NET WebForms, because even simple CRUD business applications have a lot of state to carry around that nowadays is simply managed in-memory by JavaScript. 50ms load times were out of the question; you were lucky if you could do it in 500ms. No "competent programmer" could do anything about this because WebForms didn't let them. As soon as you needed to filter one dropdown based on another dropdown, you needed to write custom JavaScript anyway.

Writing a stateful front-end that just asks for what it needs from a well-built API when it needs it is enormously simpler than trying to store all state in some server session and having to work around your own framework whenever you need a dynamic dropdown list.

We all seem to have collectively forgotten how awful web frameworks used to be, and how little interactivity the user actually expected. Things are way better now.

Re:MVC frameworks aren't dinosaurs but sharks by jolux on Monday May 09, 2022 @07:08PM (#31321079)
WebForms is an unrepresentative example because it needs to carry all the view state between the front end and backend and was enormously complicated under the hood to make the programming model easier. Nothing else works like that, the state is stored in session storage in memory on the server, and the client just sends a cookie containing the key for its session.
Re:MVC frameworks aren't dinosaurs but sharks by jiggawatts on Tuesday May 10, 2022 @01:00AM (#31323622)
To add to this: Microsoft recognized that third-party control developers were dumping too much info into the ViewState bag, and this was largely fixed in later versions.

It's also possible to store ViewState "on the server side" instead of on the client side. So instead of sending megabytes up and down with every request, the client just gets a unique identifier. The downside is increased memory usage, but that's often better, especially for internal enterprise apps.

Re:MVC frameworks aren't dinosaurs but sharks by jolux on Tuesday May 10, 2022 @08:24AM (#31326216)
Yeah, ironically the way people try to do stateless backends and heavy frontends with JWT is closer to the ViewState mess than normal MVC apps.
Re:MVC frameworks aren't dinosaurs but sharks by gamblor956 on Monday May 09, 2022 @07:16PM (#31321139)
The parent's point was that you don't need Javascript for that; some of the state (i.e., the state of the parent dropdown) could be stored in the URL, or in a form variable...which is how things were done in the days before Javascript.

Yes, you would need multiple pages. But that is how most form-based SPAs work today anyway, and avoiding a page reload isn't always preferrable to just reloading if the SPA version requires heavy amounts of JS and the good-old-static version loads in the blink of an eye.

Re:MVC frameworks aren't dinosaurs but sharks by lelanthran on Tuesday May 10, 2022 @01:27AM (#31323773)
> Almost all applications that are written in the world today are glorified forms.

Yeah, but our users like interactive forms. When a widget is changed, they like feedback instantly.

Just about any shop that reloads the entire page when you change a single filter gets annoying pretty fast.

Imagine an online computer store: tick the box for "16GB RAM", wait for page to reload, tick "32GB RAM", wait for page reload, tick "512GB SSD", wait for page reload, tick "1TB", wait for page reload.

Now you may argue you still have to wait if it is an SPA, but then you're only waiting for the results. You can quickly tick all four boxes in an SPA and each one may cause a background request, but that doesn't matter because you don't have to wait for each request to complete to make your next selection.

Re:MVC frameworks aren't dinosaurs but sharks by ihateolives on Tuesday May 10, 2022 @04:34AM (#31324832)
> Imagine an online computer store: tick the box for "16GB RAM", wait for page to reload, tick "32GB RAM", wait for page reload, tick "512GB SSD", wait for page reload, tick "1TB", wait for page reload.

Tick all the boxes and then click "Apply filter".

Re:MVC frameworks aren't dinosaurs but sharks by lelanthran on Tuesday May 10, 2022 @05:19AM (#31325061)
> > Imagine an online computer store: tick the box for "16GB RAM", wait for page to reload, tick "32GB RAM", wait for page reload, tick "512GB SSD", wait for page reload, tick "1TB", wait for page reload.

>

> Tick all the boxes and then click "Apply filter".

Many places do that, but it's not as user-friendly as not having to click "apply". If there's a large number of filters (Buying a computer on Amazon, for example), the "apply" button is off-screen most of the time - scroll to either the last filter or the first one to even know that there is an "apply" button.

Also, some fields do not work too well by having a separate "apply" filter step. You drop-down the manufacturer selection, choose "Lenovo", click apply and now there is a new drop-down for "Model".

The better experience is one where both those drop-downs exist, and second one is populated only after a choice is made on the first one. In all the pages I've seen that have drop-down #2 dependent on drop-down #1, those that got a JSON list via AJAX were much more pleasant to use than those that reloaded the entire screen just to add 5 items to the drop-down #2.

As the creator of the software, it's more important to have happy users than have an easier maintenance burden.

Re:MVC frameworks aren't dinosaurs but sharks by yohannparis on Tuesday May 10, 2022 @08:13AM (#31326127)
You don't need an SPA for that, you can still filter the DOM with JS (Vanilla or a Reactive framework) and save the state in cookie or the URL, and have the server handle the state.
Re:MVC frameworks aren't dinosaurs but sharks by lelanthran on Thursday May 12, 2022 @10:17AM (#31354569)
> You don't need an SPA for that, you can still filter the DOM with JS (Vanilla or a Reactive framework) and save the state in cookie or the URL, and have the server handle the state.

Doesn't that still reload the entire page when a checkbox is clicked?

Re:MVC frameworks aren't dinosaurs but sharks by yohannparis on Tuesday May 17, 2022 @09:19AM (#31410115)
Not necessarily, you can update the URL with the History or Location API without a reload. In that case you download the whole list and filter it on the client. The assets (images, documents, icons) can be lazy loaded, so the browser will fetch them only when visible.
Re:MVC frameworks aren't dinosaurs but sharks by likortera on Tuesday May 10, 2022 @10:57AM (#31327881)
I'm all in for reducing the usage of frontend heavy frameworks, but I also agree that as soon as you start with the "sprinkles" you're opening the pandora's box in the long term if not using state based ui rendering (what React, Vue, etc give you)

Example:

I have an application where a form input expects an URL. As soon as any URL is entered, I need to:

1) Provide feedback on wether that's a valid URL or not, before the user submits the form

2) Show a suggestion for a page title, which is usually the <head> title extracted from that URL. If the user clicks on the suggestion, that should become the value of the next input in the form.

Other than this, this is a pretty basic form. But how do you give a decent experience without JavaScript?

Right, a bit of jQuery would do it in this case... but then more and more similar small tweaks are necessary, and before you realise you're swimming in spaghetti.

Re:MVC frameworks aren't dinosaurs but sharks by mod on Tuesday May 10, 2022 @11:14AM (#31328082)
The idea that we should use react to do a form input suggestion... To avoid spaghetti code?

I can't make that logical jump. If you can't keep that tiny bit of code organized, why do you want to pile on the entirety of react and why would that be more organized?

Maybe you're saying it's a snowball of these things. I've seen that happen, but it didn't have to.

Re:MVC frameworks aren't dinosaurs but sharks by likortera on Thursday May 12, 2022 @06:49AM (#31352065)
I agree using React just for that is overkill. And yes, I'm talking about how it snowballs when you later get more requirements like now we need this dropdown to change accordingly, now we want to show validations as you write, now we need to check for email uniqueness before submitting, etc, etc...

But, the worst part in my experience, is that without one of these "opinionated" frameworks such as React or Vue, each new developer that joins the team (after others leave) have a total different idea of how to organize the code, or they have a hard time understanding the "custom" organization and ideology behind the structure you've had to invent to keep in maintainable.

Again, I'm not a fan at all of frontend heavy frameworks, but they do solve a real problem, specially in large apps and large teams or teams with a lot of turnover.

I'd say it is the exact situation in the backend regarding using Flask vs Django, Sinatra vs Rails, etc... having a set of imposed opinions and structure have long term benefits as soon as you're not the only one working on the codebase.

Re:MVC frameworks aren't dinosaurs but sharks by zodiac on Tuesday May 10, 2022 @04:26AM (#31324785)
50ms is under human detection?

maybe 50ms is under the "conscious detection" threshold (debateable, IMO...) but it will definitely feels "laggy"

Re:MVC frameworks aren't dinosaurs but sharks by ratww on Monday May 09, 2022 @06:42PM (#31320828)
Bit of an off-topic hot take, so sorry in advance, but:

In my experience with hiring, the only reason it has become easier to move a lot of logic and state to the frontend is because frontend developers are plentiful and easier to hire. I'm not dissing them: it's very easy to find great frontend devs that know their tools inside-out and also know the fundamentals of software engineering.

On the other hand, good backend developers are becoming rarer and rarer, and most of the new breed struggles to do virtually anything beyond a cookie-cutter REST API. Very few are knowledgeable about databases, for example. Very few know about deployment. Some of them aren't even familiar with HTTP as a protocol. Any backend dev that I interview that is as knowledgeable about their niche as the frontend devs I interview often gets two or three other offers and we have to raise offers very very often.

I'm pretty sure there's lots of great backend engineers who could do SSR like we did back in 1990-2010 with one hand behind their backs. But there just isn't enough of those. Most of the ones you see will have no idea how to deal with it.

Re:MVC frameworks aren't dinosaurs but sharks by Nextgrid on Tuesday May 10, 2022 @10:25AM (#31327507)
On the other hand, maybe hiring one good backend dev and paying them 2x market rate is still cheaper than having a frontend team to (poorly) reinvent the wheel?
Re:MVC frameworks aren't dinosaurs but sharks by ratww on Tuesday May 10, 2022 @04:41PM (#31332415)
Definitely!

On the other hand... maybe not, for more conservative industries? You don't need a full-blown frontend team to be very productive. A great frontend engineer (easy to find) and a cookie-cutter backend code-monkey (also easy to find) working together and getting paid 1x each are probably as productive as a great backend engineer you're thinking of paying 2x.

But the thing is that the 2x will bring some extra experience, less bugs... but that's not what companies are after.

So yep you have a point.

Re:MVC frameworks aren't dinosaurs but sharks by moonchrome on Monday May 09, 2022 @03:51PM (#31318900)
In my experience server side rendering becomes really messy once you hit complex state management. Shuffling shit between pages, persistent vs transient state, handling reload/resubmit logic, validation. It works for simple stuff but even then I think once SPA tech matures more (ironically even after all this time I think transpilers/bundlers/package managers in JS still have a long way to go to get out of the way and frameworks are still far from optimal) anything that's not a web page should handle UI logic on the front-end.
Re:MVC frameworks aren't dinosaurs but sharks by marginalia_nu on Monday May 09, 2022 @06:07PM (#31320449)
All code, across all paradigms, frontend, backend, low level, high level, whatever; all code becomes really messy when you have complex state management.

The solution in each of these cases is the same, though. To simplify the state.

In general, I think a lot of the pain in web development comes from attempting to have shared mutable state between backend and frontend. Shared mutable states are almost always messy. You can get around that by pushing it all to the frontend, or pushing it all to the backend. It's when it's straddling both you're in for a headache.

Re:MVC frameworks aren't dinosaurs but sharks by moonchrome on Monday May 09, 2022 @08:34PM (#31321834)
I agree - but you can't simplify when your tools complicate - in the sense that they intertwine different concerns. As soon as you're not dealing with trivial apps "pushing it all to backend" isn't really an option if you want good user experience - and then you'll have to have logic on frontend as well. And that's where the pain comes.
Re:MVC frameworks aren't dinosaurs but sharks by zippercreatemy on Monday May 09, 2022 @06:01PM (#31320388)
WHAT??? Okay I am going to bite, state is managed by the browser and then SPAs came along and tried to hack the state management ever since. I remember creating SPAs in 2004 when it was called AJAX and there was the debate of HTML or JSON over the wire. The biggest issue was back and forward buttons, even today that issue is not solved very well by SPAs.

The issue I have is we had a great idea to refresh parts of a page with AJAX and then we went overboard and tried to move the entire application to complex frameworks which add more problems then they solve. We became so scared of screen rendering we avoided at all costs. This is bad UX as users actually get good confirmation that something has happened when there is a screen refresh.

Re:MVC frameworks aren't dinosaurs but sharks by bsder on Monday May 09, 2022 @09:20PM (#31322218)
> Rendering HTML server-side is just nice. It's simple and easy to work with. Weird states are unusual. The user gets a really normalized, predictable experience. And done well/quickly, there's little actual difference.

It has also been forgotten that people used to complain about 100ms of latency. Since then, modern users (especially mobile) have been trained to accept horrible latencies that would have gotten you excoriated back in 2000.

100ms of latency is MUCH more difficult to deal with server side than 2-3 seconds of latency. 2-3 seconds is an eternity with modern clouds and modern network connections.

Re:MVC frameworks aren't dinosaurs but sharks by hsbauauvhabzb on Monday May 09, 2022 @03:54PM (#31318924)
You only need what’s appropriate. I doubt missile launch systems are using react or whatever fancy frontend engineers want to use. SPAs are responsive which is nice, but some projects could better spend their time ensuring the project actually functions.
Re:MVC frameworks aren't dinosaurs but sharks by hawkeyedan on Monday May 09, 2022 @11:39PM (#31323163)
Sadly, that might not be a great bet. The world of government software procurement is very, very ugly.
Re:MVC frameworks aren't dinosaurs but sharks by sanderjd on Monday May 09, 2022 @05:41PM (#31320147)
Of the people I know who hold this view I know many software developers and zero other people. Even other very technical people, like data scientists, prefer an interactive interface to a series of pages.
Re:MVC frameworks aren't dinosaurs but sharks by gamblor956 on Monday May 09, 2022 @07:20PM (#31321174)
Of the people I know, ranging from programmers to HR people, most of them prefer the series of pages over the interactive interface for business processes. The series of pages makes it obvious that something has happened in response to input.

OTOH, for stuff like Facebook they absolutely prefer the interactive interface.

Re:MVC frameworks aren't dinosaurs but sharks by sanderjd on Tuesday May 10, 2022 @11:56AM (#31328629)
The business people I know would mostly rather just do their business processes in Excel rather than a web browser :)
Re:MVC frameworks aren't dinosaurs but sharks by zhte415 on Monday May 09, 2022 @09:52PM (#31322446)
Almost everyone I know likes to have an expected response when pressing a button.

In fact, I don't know anyone that doesn't.

Re:MVC frameworks aren't dinosaurs but sharks by sanderjd on Tuesday May 10, 2022 @11:57AM (#31328639)
This seems like an orthogonal question? I agree that whatever technology one chooses, buttons should be responsive when pressed. A page load is not the only kind of button press response that is possible.
Re:MVC frameworks aren't dinosaurs but sharks by mxmxnxor on Monday May 09, 2022 @04:11PM (#31319113)
>Rendering HTML server-side is just nice

No, rendering html server-side is not nice and never was. Why on earth you will send markup template for every list item over and over again instead of sending just data and only one code-template (to render data on a client) ? Suppose you need to show to user a list of books on your web-page. Server side rendering means you need to send to user a markup consists of html elements for every book

<div> <div class="book"> <div class="book-title">Book 1</div> <div class="book-author">Author 1</div> <div class="book-description">..description..</div> </div> <div class="book"> <div class="book-title">Book 2</div> <div class="book-author">Author 1</div> <div class="book-description">..description..</div> </div> <div class="book"> <div class="book-title">Book 2</div> <div class="book-author">Author 2</div> <div class="book-description">..description..</div> </div> </div> ...

Don't you see something wrong with this? Why you need to duplicate over and over again html template for every list item resulting of significant increase of size of page to download if you can send only one template-component like this

<div> <div class="book"> <div class="book-title">{book.title}</div> <div class="book-author">{book.author}</div> <div class="book-description">{book.description}</div> </div> </div>

and a data in a more compact way

[{title: "Book 1", author: "Author 1", description: "..."}, {title: "Book 1", author: "Author 1", description: "..."}, ...]

or more compact like this

[["Book 1", "Author 1", "..."],["Book 1", "Author 1", "..."], ...]

or even in more compact binary-encoded format resulting in more than magnitude size compaction comparing to over-duplication html-approach. More size means more traffic for users to download over network and users which use data-roaming will "thank" you for your hundreds of kilobytes instead of dozens

This is why server-side rendering approach was flawed from the beginning (not because of page reloading but because of data duplication and traffic consumption)

Re:MVC frameworks aren't dinosaurs but sharks by potatoz2 on Monday May 09, 2022 @08:08PM (#31321605)
This is wrong because you’re not considering the whole picture:

- to turn the JSON into HTML, you not only need the template you mentioned, you also need code to execute that template (potentially lots of it); preact is 10KB ungzipped (other frameworks, like React/Angular/Ember, are way larger), so your HTML solution is already 10,000 characters ahead (by comparison, the markup you demoed is ~90 bytes per book, so you’re ahead until at least ~100 books on the page, without considering the framework, your code, and the following points)

- HTML compresses amazingly well because it’s repetitive so the overhead is less than you think

- HTML stream renders, so you can start rendering the first book immediately; JSON streaming is technically possible, but not built-in, and quite difficult to implement (and it requires even more JS)

- the same KB of JS is way more expensive than it would be as HTML (or images) because parsing, compiling, and executing is slow

- latency is often a larger problem than bandwidth, especially on mobile, so saving bandwidth is less important than (a) streaming and (b) client-side blocking time

- a large number of users visit one page and bounce, for typical websites, so the promised savings once the SPA is live doesn’t materialize

- the naive way to implement a SPA is _full_ of footguns; first of all, you’d naively load the template for all the pages, making the overhead problem even worse, naively you wouldn’t render anything until the JS has arrived, delaying the TTFMP enormously, naively you’d mess up routing, etc.

- it’s relatively trivial to preload/precache HTML pages, including in a service worker to support offline, making performance on par or better than a SPA

I happily work on a huge SPA daily, for context.

Re:MVC frameworks aren't dinosaurs but sharks by mxmxnxor on Tuesday May 10, 2022 @03:18AM (#31324434)
- about HTTP compression (gzip, brotli) - it works on byte/text level and doesn't know about your markup template repetition (where structure is mostly the same but small changes everywhere) so it will be not as efficient as manual template-data separation

- about SPA - in my comment I said no word about SPA, it's a more complex layer on top. I only arguing about template-data separation approach to decrease data duplication and traffic consumption. And no, you don't need to rewrite your app as SPA and no react/preact/javascript frameworks required. You can use your server-side rendering and just change format of what you are sending to user. Instead of sending index.html with repetitive html markup for every list item you can basically send script-tag where you loop over data and build html-markup directly on a client

<doctype html>

<html>

<body>

   ....

   <div id="books"></div>

   <script>

     const data = [{title: "...", author: "...", description: ""}, {...}]

     document.querySelector("#books").innerHtml = data.map(item=>`

        <div class="book">

           <div class="book-title">${item.title}</div>

           <div class="book-author">${item.author}</div>

           <div class="book-description">${item.description}</div>

        </div>

     `).join(``);

   </script>

 </body>
</html>

Yes, it lacks http streaming but - less repetitive html markup -> smaller size -> less time to download -> http streaming becoming less useful

And again - you can use your favorite http compression (gzip, brotli, etc) on top of this template-data separation approach to compress even more

Re:MVC frameworks aren't dinosaurs but sharks by potatoz2 on Monday May 16, 2022 @03:22PM (#31402104)
I’ve just tested what you suggest with a page that contains 20 books (no HTML or JS minification, and probably some typos because I didn’t run it).

https://pastebin.com/8CM1eUKQ the HTML version https://pastebin.com/ujrai58n the templated version

Even I was surprised by the result. The original size is what you’d expect: 5.3K for the full HTML version, 2.4K for the JS template version. Once Brotlied (default compression) however, the situation changes completely: 127 bytes (!) for the pure HTML version and 197 bytes for the template version. This is even true for Gzip, 213 vs 284 bytes.

I don’t know if Brotli (and Gzip) are somehow optimized for HTML, but yeah it really doesn’t make sense to use templates here.

Re:MVC frameworks aren't dinosaurs but sharks by rpdillon on Monday May 09, 2022 @04:42PM (#31319433)
> Why on earth you will send markup template for every list item over and over again instead of sending just data and only one code-template (to render data on a client)?

I see what you're saying, but I think server-side rendering is simpler, and the concern about repeated HTML tags in the content is likely much easier to address by using gzip over the wire.

Re:MVC frameworks aren't dinosaurs but sharks by tored on Monday May 09, 2022 @05:53PM (#31320288)
Not necessarily, because you have to consider the entire lifecycle.

When doing frontend rendering you usually work against a REST(ful) API to fetch data, the idea is to reuse endpoints for multiple frontend components, because of this generalization you usually end up sending more data than necessary, not only between the database and the backend, but also between the backend and the frontend.

And not only that, you start doing JOINs over HTTP and JavaScript.

With server side rendering I can write an exact SQL query to render that component.

Re:MVC frameworks aren't dinosaurs but sharks by jvanderbot on Monday May 09, 2022 @05:07PM (#31319763)
Ah ... calling server-side "flawed from the beginning" is a bit overkill. The use case is a bit convoluted. HTML itself is not the problem that slows down modern web experience, is it?

Also, in your example, don't forget the code required to render that data, which is often a second fetch and is, you guessed it, utf-8 / ascii/ unicode. Now we've double startup costs or forced http/2.

There's some context with these opinions. I concur that rendering server-side is often much, much simpler, but acknowledge that might be because that was what came first; and I acknowledge that some of the hate against client-side is b/c modern web often feels bloated and JS takes the blame.

Re:MVC frameworks aren't dinosaurs but sharks by selcuka on Monday May 09, 2022 @08:19PM (#31321708)
> Why on earth you will send markup template for every list item over and over again instead of sending just data and only one code-template (to render data on a client) ?

You have a point, but not everything needs to be black and white. We had this nifty technology called AJAX even before SPAs were a thing. Now I understand that SPAs are built on AJAX calls too, but it is also possible to render (most of the) HTML on the server side and only use AJAX using off-the-shelf components such as Datatables when you absolutely need that functionality.

Re:MVC frameworks aren't dinosaurs but sharks by inb4_cancelled on Monday May 09, 2022 @04:26PM (#31319273)
Two words: HTTP compression
Re:MVC frameworks aren't dinosaurs but sharks by mxmxnxor on Monday May 09, 2022 @04:47PM (#31319494)
HTTP compression (gzip, brotli) works on byte/text level and doesn't know about your markup template repetition (where structure is mostly the same but small changes everywhrere) so it will be not as efficient as manual template-data separation. Moreover you can also use gzip, brotli for your template and data so http compression doesn't change the overall picture
Re:MVC frameworks aren't dinosaurs but sharks by potatoz2 on Monday May 09, 2022 @07:56PM (#31321514)
It changes the overall picture because HTML compresses better than JSON, which itself compresses better than your deduped arrays (because of the duplication you’re trying to avoid). So the HTML would be closer in byte size to the most compressed version you’ve shown than it appears, after compression.
Re:MVC frameworks aren't dinosaurs but sharks by Lio on Monday May 09, 2022 @05:29PM (#31320017)
^^^ this. Plus you’re probably going to have to render the JSON you send on the server and then rerender it as HTML on the client plus send the code amd template to do that too.

Also I know there’s the promise of sharing code between the front and backend but the reality is that you’re probably more likely to reimplement one or the other and then have to keep them in sync.

The overhead for doing it just the once on the backend and sending compressed HTML over the wire is pretty low for a small team in comparison.

Re:MVC frameworks aren't dinosaurs but sharks by louissan on Monday May 09, 2022 @04:30PM (#31319311)
a third word: DIVitis.

but yeah, gzip or the more recent ones such as brotli have been taking care of those things for 25 years....

so HTML server-side has always been nice.

Especially semantic markup cough cough

Re:MVC frameworks aren't dinosaurs but sharks by fnord123 on Monday May 09, 2022 @04:28PM (#31319292)
Do you even gzip transfer-encoding?