News for hackers. Stuff that matters.
Re:A Front End Does Not Have to Be Rich by duncan-donuts on Monday March 11, 2019 @02:27PM (#19361431)
I agree with what is being said, but I don't really see any new thoughts here. This is such a tired conversation. I used to have opinions about this, but I've grown to have a position of, "ship over anything else". Do whatever you can to ship faster. If that is nextjs, great. If that just a bunch of PHP files on an apache server? great. None of it is one-sized fits-all. /shrug
Re:A Front End Does Not Have to Be Rich by collyw on Monday March 11, 2019 @02:34PM (#19361512)
In my experience going SPA seems to double the amount of code needed (at least).
Re:A Front End Does Not Have to Be Rich by williamdclt on Monday March 11, 2019 @02:45PM (#19361634)
Maybe (I would instinctively agree). But amount of code is not a good metric for almost anything.

What about amount of features? Time to ship? Time between releases? Number of bugs? User satisfaction? Development costs? ROI? Ease of hiring? Scalability? Reliability?

Not particularly saying an SPA is better at the criteria above (not saying it isn't either), but these criteria are way more important than "amount of code"

Re:A Front End Does Not Have to Be Rich by collyw on Monday March 11, 2019 @03:04PM (#19361814)
If you view code as a liability then more code is worse.
Re:A Front End Does Not Have to Be Rich by polygotdomain on Monday March 11, 2019 @04:36PM (#19362574)
Viewing code as a liability does not make it worse, as not all code as the same level of liability associated with it. I'd much rather have double the lines of code if it yielded a code base that was more maintainable, easier to reason about, easier to debug, and had better separation of concerns.
Re:A Front End Does Not Have to Be Rich by lubonay on Monday March 11, 2019 @03:10PM (#19361843)
Well okay, but is it the ultimate liability? What if 2x the code gives you 10x the value?
Re:A Front End Does Not Have to Be Rich by collyw on Wednesday March 13, 2019 @04:04AM (#19376658)
OK, I'll expand my comment to say that "more code for the same functionality is a liability".
Re:A Front End Does Not Have to Be Rich by bunderbunder on Monday March 11, 2019 @06:03PM (#19363311)
This is such a thorny issue.

First off, there's the reductio ad absurdum in the room: perl. Using perl, I could rip off some amazing things in amazingly little code. (Forth, too, come to think of it.) I think, though, that most of us who initially fell in love with it eventually came to learn that denser code is not necessarily better code. Nowadays I'll gladly take the same thing written in 5X as much Python code.

Second, sometimes more code provides useful things, like bulkheads and seams that allow for easier modification in the future. Over in OO-land, I find that writing SOLID code often increases line counts considerably, but I still strongly prefer my code to be SOLID.

Long story short, I find that code volume can be a proxy for code quality, but it's a very imperfect one.

Re:A Front End Does Not Have to Be Rich by williamdclt on Tuesday March 12, 2019 @10:36AM (#19368521)
> bulkheads and seams

I really like those analogies, I'll reuse them!

Re:A Front End Does Not Have to Be Rich by bunderbunder on Monday March 11, 2019 @03:09PM (#19361837)
This pokes at one of my suspicions: Personally, I agree that SPAs are way more complicated and heavyweight than you need for most sites. And they do seem to require a lot of code up-front.

But it's also true that I see a lot of dissatisfaction around the long-term maintainability of doing things in basic HTML/CSS. And I'm not aware of any compelling options that give you better better modularity, but aren't some super heavy-handed SPA-centric framework like React.

Re:A Front End Does Not Have to Be Rich by baddox on Monday March 11, 2019 @04:12PM (#19362339)
Projects that start out as basic HTML/CSS (perhaps with server generation, like Rails) can run into major problems when they gradually need to start adding interactive features (which, in my experience, is almost certainly going to be the case with any company whose website is a significant part of their product and who have not yet found product-market fit).

It's really easy to use jQuery or some small purpose-built JavaScript library to add simple interactive features like a datepicker or accordion menu. But then you start building your own interactive features, with no framework or architecture in place to manage the ever-increasing amount of client state that is changing in a user session.

At some point (and I would argue it's pretty early on), it becomes far simpler to have a client-side UI framework/library/architecture in place, even if it is initially too heavy for your current needs. Your website is probably not going to need less interactivity as your product and business progresses.

Re:A Front End Does Not Have to Be Rich by ergothus on Monday March 11, 2019 @04:05PM (#19362270)
> But it's also true that I see a lot of dissatisfaction around the long-term maintainability of doing things in basic HTML/CSS

this. I've been front-end for the last several years, and I always tell my managers that front end doesn't need to write for scalability or extensibility (though those are both GOOD!), it needs to first prioritize _replaceability_. Because the "asks" will change dramatically in just a few years, even if the tech doesn't change (and the tech does also change - stupidly fast).

In fact, most backend systems I've seen that are a mess actually work great...if you use them as originally intended. But the current asks are different than those. Software both requires assumptions and doesn't handle changes in assumption well.

Anyone arguing from a point of code purity without acknowledging these facts doesn't persuade me of much. Sadly, this means that in the regular churn we don't get to pull in all the truly valuable points that are left aside with the other items. (See how much of the industry, myself included, is re-learning lessons learned by the early programming pioneers)

Re:A Front End Does Not Have to Be Rich by warent on Monday March 11, 2019 @03:17PM (#19361908)
> Personally, I agree that SPAs are way more complicated and heavyweight than you need for most sites.

This hasn't been my experience at all. SPAs are so simple for me to spin up these days with all the tooling to cover the boilerplate for you, e.g. create-react-app or Vue CLI. With the advent of cloud providers, hosting is insanely simple too. You can get a working SPA out in a day complete with a frontend, backend API, and a database.

Re:A Front End Does Not Have to Be Rich by bunderbunder on Monday March 11, 2019 @03:44PM (#19362121)
The experience is definitely easy, but it's hard to believe that it's simple. Oftentimes things that are very easy on the surface have a whole lot of complexity going on under the hood.

In the case of SPA frameworks, I've not spent much time with them (I'm the back end guy on my team), but the most striking things I see whenever I get involved in a project that uses them, and when I've taken the time to learn them, is that there are just so many moving parts. And a whole lot of stuff about the internal logic of whatever SPA framework you're using, and possibly how specifically you're using it, that a newcomer has to know before they can really work efficiently. They're so complicated that I sometimes see people having to do some really elaborate things to get them to play nicely with other stuff they want to do. Using D3 in the same site comes to mind there.

Re:A Front End Does Not Have to Be Rich by dublo7 on Tuesday March 12, 2019 @03:46PM (#19372174)
I can build a whole app in only a hundred lines of code once I add a million lines of code... :)
Re:A Front End Does Not Have to Be Rich by ngrilly on Monday March 11, 2019 @04:03PM (#19362259)
How cloud providers make hosting simpler for SPA and not for server-side rendered apps? Agreed, for the front, you can use something like Netlify. But for the backend, the game has not changed. What do you use?
Re:A Front End Does Not Have to Be Rich by duncan-donuts on Monday March 11, 2019 @02:55PM (#19361737)
I haven't had that experience. I will agree -- going with a SPA has pretty much always made things more complicated than they needed to be. I've always liked SPAs, but won't use them if I'm building a site that doesn't have complex interactions. Idk, there's a pro/con for any tech in your stack. It depends on what you actually want to be stuck supporting.
Re:A Front End Does Not Have to Be Rich by sbov on Monday March 11, 2019 @03:48PM (#19362152)
When it comes to speed of delivering, the most important thing is usually what you have experience in. If most of your experience is in SPAs then go for it.
Re:A Front End Does Not Have to Be Rich by collyw on Wednesday March 13, 2019 @06:41AM (#19377450)
With SPAs you are going to need experience in a frontend and a backend framework. With server side rendering you can get away with only knowing the backend framework well.
Re:A Front End Does Not Have to Be Rich by stackola on Monday March 11, 2019 @02:45PM (#19361636)
Only if you count the node_modules
Re:A Front End Does Not Have to Be Rich by mosselman on Monday March 11, 2019 @03:06PM (#19361825)
If you'd count that code you'd probably have around 1000x more code than an html-rendering back-end.
Re:A Front End Does Not Have to Be Rich by sbhn on Monday March 11, 2019 @02:59PM (#19361782)
Yay, the world is waking up, google search is not spa, Ebay is not spa, Wkipedia is not spa, Youtube is not spa, Stack exchange is not spa, Duck Duck Go is not spa, HomeIdea3D.com is spa though
Re:A Front End Does Not Have to Be Rich by snazz on Monday March 11, 2019 @03:24PM (#19361975)
Google, eBay, Wikipedia, YouTube, Stack Exchange, and DuckDuckGo fit nicely with the concept of “type search in form, get list of links, video, article, QA page, etc.” HomeIdea3D tries to emulate/replace a desktop application. This is the type of tool that I would allow a SPA for, even though I normally browse with JS disabled.
Re:A Front End Does Not Have to Be Rich by maxxxxx on Monday March 11, 2019 @03:12PM (#19361866)
HomeIdea3D.com is a real app with complex state and stuff so an SPA makes sense here.
Re:A Front End Does Not Have to Be Rich by Conlectus on Monday March 11, 2019 @03:32PM (#19362029)
YouTube is indeed a SPA.
Re:A Front End Does Not Have to Be Rich by ngrilly on Monday March 11, 2019 @04:06PM (#19362287)
YouTube is not really a SPA as in React or Vue. It looks like they use something similar to TurboLinks or Intercooler: https://youtube.github.io/spfjs/

Edit for downvoters: Ok, technically, YouTube is a SPA. What I meant, in the context of this discussion, is that YouTube uses a technique similar to what GitHub does, where the server returns fragments of HTML.

Re:A Front End Does Not Have to Be Rich by dunk010 on Monday March 11, 2019 @02:53PM (#19361714)
Hear, hear!