News for hackers. Stuff that matters.
Re:Advice to Young Web Developers by osrec on Thursday June 18, 2020 @03:35PM (#23566897)
The way in which we consume and deliver via internet has moved on from the early days of the web. It's no longer just text, images and links. There's much more to it now, and SPAs are a reasonable step forward to providing richer experiences online with more functionality.

Not sure you could ever call them an anti-pattern.

Re:Advice to Young Web Developers by timw4mail on Thursday June 18, 2020 @04:15PM (#23567461)
> It's no longer just text, images and links.

Assuming you add video, 99% of the web is just text,images,links,forms, and video. None of these things even require Javascript.

Re:Advice to Young Web Developers by osrec on Thursday June 18, 2020 @06:20PM (#23568786)
I'd say a big part of the web is gaming, chatting, interacting. A lot of that content updates every few seconds. Without JS, websockets, ajax requests etc, do you suggest users load the entire page again whenever they want to see an updated view?!

Or is your opinion that it should only be possible to do those things in native, purpose-built apps? Because in that case, how do you justify using an operating system? Perhaps we should exclusively use purpose-built assembly code that you flash to some writable media every time you want to run a particular program!

Re:Advice to Young Web Developers by timw4mail on Thursday June 18, 2020 @06:48PM (#23569008)
As another poster said: The right tool for the right job.

Also, a SPA is not the only option with Javascript.

Re:Advice to Young Web Developers by chipotle_coyote on Thursday June 18, 2020 @04:45PM (#23567806)
How would the site we’re communicating on right now be improved if it were rebuilt as an SPA?
Re:Advice to Young Web Developers by osrec on Thursday June 18, 2020 @06:15PM (#23568740)
Threading could be clearer. Less data would need to be loaded on each page load. I can imagine that a lightweight SPA to handle the a few standard views (e.g. listItems, itemDetails, profile, changePassword, submit) would cut down data transfer by a significant margin (20-30%, maybe more). The UI could also be much better on mobile, and we could give users the option to cache certain pieces of content offline.
Re:Advice to Young Web Developers by ptx on Thursday June 18, 2020 @08:49PM (#23569845)
Offline use already works great, unlike in any SPA I've ever used.

1) Load the page.

2) The page is now fully loaded and ready for reading without any need for further network requests.

For even more offline use, try printing it! HN threads work superbly when printed, again unlike most modern sites.

Re:Advice to Young Web Developers by osrec on Friday June 19, 2020 @05:44AM (#23572804)
I don't think printing is a viable solution for most users. I'm guessing most would want to download the comment threads to their phone so they could read them later in situations where connectivity is patchy (eg train/plane etc).
Re:Advice to Young Web Developers by ptx on Friday June 19, 2020 @08:41AM (#23573887)
Right. You can do this now by loading the page in a background tab, leaving the tab open and then going offline. Works great.

Or you could reimplement newsgroups (but with less interoperability) as an SPA, which in theory would work great (once you work out the kinks) but in practice would suffer from all kinds of little issues in the from-scratch reimplementation of everything. For example, printing would probably forever be a wishlist item in the backlog.

Re:Advice to Young Web Developers by runawaybottle on Thursday June 18, 2020 @07:18PM (#23569226)
What you’re suggesting is heresy on HN. It’s true, a little bit of interactivity, fonts/padding/spacing would improve HN. To this day my thumb covers both the upvote and down vote button.
Re:Advice to Young Web Developers by osrec on Friday June 19, 2020 @05:48AM (#23572824)
Yes, the UX on mobile leaves a lot to be desired in my opinion. The two things that are going for HN in its current form is the fact that it's lightweight and fast.

A lot of people think that moving to an SPA would mean killing both those aspects. But the truth is, you CAN have an SPA that is both lightweight and fast - the developer just needs to know what they're doing.

Re:Advice to Young Web Developers by timw4mail on Friday June 19, 2020 @07:35AM (#23573326)
I have yet to see this...
Re:Advice to Young Web Developers by runawaybottle on Friday June 19, 2020 @04:15PM (#23578460)
You can check out nodebb for example, tons of JavaScript and quite frankly it’s a better forum experience than reddit or HN:

https://community.nodebb.org/category/2/general-discussion