this post was submitted on 26 Apr 2024
456 points (96.7% liked)

Programmer Humor

32461 readers
728 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 2 points 6 months ago* (last edited 6 months ago) (1 children)

For example, you can do offline PWA with SPA since a page load doesn't need a call to the server for rendering it.

Client still needs to call the server. How offline PWAs work then? They emulate server in ServiceWorkers.

It also saves processing time/bandwidth by offloading the server from the burden of rendering the page.

  1. Let's call it page generation to not confuse with actual rendering.
  2. It not always saves bandwidth and processing time, but static resources can allow to hide CDN latency on initial load. Although it is not property of SPAs, just separation of static and dynamyc part and generating dynamic part after static page already shows something.
  3. It will still result in more requests, but may trasfer less data per request. May.

Once the page has loaded, the web app only needs data, not markup nor style.

Static web page after loading will not request more styles. SPAs imply client-side dynamic page, and they may request more data INCLUDING styles. Also client still need to load styles on page load.

And last is that it is great since it only requires a browser without needing to write native apps in myriad of languages.

~~Write for QT.~~

And when you are deploying it for 24/7 use, down times can be costly. Deploying to cloud early and then slowly building towards on-premise after the team gets bigger is a viable route IMHO

I guess so. Not everything can be offline-oriented.

[โ€“] [email protected] 2 points 6 months ago

Client still needs to call the server. How offline PWAs work then? They emulate server in ServiceWorkers.

Yes they do need server for initial resource loading. Usually with PWA, you need to fetch the static resource once from a CDN since every resource is bundled. And no, they don't need to emulate server in service worker, wtf. You can if you want, but you can also store the data locally using indexeddb and sync periodically baked into the app. Service worker doesn't emulate server, they just intercept a network call and check their cache. A man in the middle if you will. I think it is debatable if that is called emulating a server or not.

  1. Let's call it page generation to not confuse with actual rendering.

Yeah, that is fair. Its just the usual web tech shenanigans.

  1. It not always saves bandwidth and processing time, but static resources can allow to hide CDN latency on initial load. Although it is not property of SPAs, just separation of static and dynamic part and generating dynamic part after static page already shows something.

When developing an application, you usually didn't develop the dynamic and static part separately. Which data can be cached and which needs to be sent to the origin so it can be properly generated. If you fail to configure it correctly the static resource which should go to a CDN get sent to your origin instead. With SPA you just ship the frontend to the cdn and make the backend separately.

  1. It will still result in more requests, but may trasfer less data per request. May.

I mean, if you are making an SPA without splitting the bundle, there should only be a single html, css, and js. A bunch of images and some font too if you want to be complete. But if you are making the page server generated, you always need to transmit the HTML. ALWAYS. So I think it definitely saves requests.

Static web page after loading will not request more styles. SPAs imply client-side dynamic page, and they may request more data INCLUDING styles. Also client still need to load styles on page load.

SPA will not request more style if you are bundling them tho? Wtf are you talking about? Unless you explicitly split the style, once SPA is loaded every page navigation is just JavaScript replacing the whole HTML with the one bundled in the JS file.

~~Write for QT.~~

Sure, QT exist as a UI library for cross platform. But that doesn't solve the iOS mafia. We only got Apple to allow 3rd party store now, we haven't got sideloading yet. It is a hassle if you want to make an app that can be used in any devices. Especially if the app is just some form filling app.