News for hackers. Stuff that matters.
Re:Show HN: Sapper.js – towards a better web app framework by scottmf on Tuesday January 02, 2018 @12:20PM (#16053358)
I feel like a lot of HN is stuck in 2010 and dislikes all of this new web tech because they don’t understand it.

This comment is a prime example.

Re:Show HN: Sapper.js – towards a better web app framework by bdcravens on Tuesday January 02, 2018 @12:58PM (#16053702)
Isn't the opposite true? A lot of "younger" developers are stuck disliking anything older than 2010 because it's not "new". Not because it's slower, or creates a bad experience for the customer, but because it's not new. If it's not faster, and doesn't provide a competitive advantage (I'm talking about real competition, not the pseudo-competitive market of "hire all the developers by dangling shiny new tech in front of them"), then what's the point? (There are certainly use cases where new approaches make sense, but that doesn't mean they become the new defaults)
Re:Show HN: Sapper.js – towards a better web app framework by RobertRoberts on Tuesday January 02, 2018 @12:44PM (#16053587)
I've been doing webdev since 1999. I've seen all manner of stupid hacks, dumb "best practices" that have come and gone, ridiculous frameworks that became _useless_ because browsers just integrated the features. Flash home screens, table layouts, IE only coding up the wazoo.

So, when someone says they have a JS framework that replaces the core of the browser's display, the DOM, my response to that is sigh, this again.

Shadow DOM is around the corner, what then?

The reason this stuff gets popular is not because it's a good idea, it's because big companies have tons of cash and man power and can't wait for browsers to get updated. Well, a lot of us code monkey vets are done chasing "shiny crappolla", and we can wait a bit until the dust settles.

How many JS frameworks are there now? I saw all of them come, where is ember, knockout, etc...? Vue just popped up, and I can't even recall the other 5 I tried out at the same time. Which will succeed? When you have to put real money into a project and the framework matters to your clients budget, and your profitability, you can't make a risky bet and expect your client to pay for it later if you are wrong.

I am all for the long term now. Show me how a 1 year old framework is a good investment, I am willing to learn something. (keep in mind React is only about 4.5 years old, Angular is only 15 months old (AngularJS is 7 just years old and already being phased out!))

Re:Show HN: Sapper.js – towards a better web app framework by dmitriid on Tuesday January 02, 2018 @01:29PM (#16054022)
> Shadow DOM is around the corner, what then?

Nothing changes. DOM remains a slow monstrosity impossible to code for. For goodness sakes, reading certain properties in a DOM tree causes a full page reflow [1]

To beat virtual DOM frameworks you have to write extremely specific vanilla JS+DOM code that basically ends up doing the same thing: re-using DOM nodes, event delegation etc. See [2]

Shadow DOM was never meant to be an answer to that. Honestly, I have no idea what it was supposed to be an answer to.

[1] https://gist.github.com/paulirish/5d52fb081b3570c81e3a

[2] https://medium.com/@localvoid/how-to-win-in-web-framework-be...

Re:Show HN: Sapper.js – towards a better web app framework by scottmf on Tuesday January 02, 2018 @01:25PM (#16053984)
You should learn React and build a simple project with it to understand its real value, which is component-based architecture.

React will likely be around longer than/as long as any framework, but whatever replaces it will use a lot of the same concepts.

Re:Show HN: Sapper.js – towards a better web app framework by RobertRoberts on Tuesday January 02, 2018 @02:00PM (#16054366)
How does that help 1000 visitors to a blog read the blog easier? Not every site is an app, and the apps we do build we already have invested in VanillaJS framework. Do you think React will outlast the VanillaJS framework? (http://vanilla-js.com/)

(edit: this is partly a joke comment, fyi)

Re:Show HN: Sapper.js – towards a better web app framework by scottmf on Tuesday January 02, 2018 @06:06PM (#16056732)
I understand the joke but JS isn't a framework, it's a language.

"No framework" generally means "poorly-written custom framework". Do you have any code samples to share from your vanilla JS apps?

Re:Show HN: Sapper.js – towards a better web app framework by unclebucknasty on Tuesday January 02, 2018 @08:33PM (#16057570)
>"No framework" generally means "poorly-written custom framework"

This thinking is part of the problem: the idea that not-using a framework almost necessarily means you're writing garbage.

>Do you have any code samples to share from your vanilla JS apps?

I can show you bad code from popular frameworks too--in particular, hacks to get around the "magic" that frameworks offer.

And, invariably, we move on from the framework because now there's "something better". And, we say "that's just progress". No one wants to admit that the last framework was just bad.

It's a trend that's been going on for decades in programming, and not just with JS frameworks. Stick around long enough and you'll see exactly how predictable it is.

Re:Show HN: Sapper.js – towards a better web app framework by Silhouette on Tuesday January 02, 2018 @10:52PM (#16058208)
"No framework" generally means "poorly-written custom framework".

That is not generally true at all. It might be true if you've got a very inexperienced and unskilled team of developers who don't know how to build a non-trivial application without the structure that a framework brings. However, there must be millions of developers in the world who do have sufficient skill and experience to do that, and these days plenty of those people work in web development. I imagine they can still remember how to do things like basic software design and using libraries, which have been working since long before any of these modern frameworks existed.

Re:Show HN: Sapper.js – towards a better web app framework by megaman22 on Tuesday January 02, 2018 @10:57PM (#16058233)
I'm afraid you're being terribly optimistic. I'm not totally sure how many millions of people, in absolute numbers, are even competent developers. Out of those, some are web developers, and some subset of those are doing things without frameworks. That leaves a lot of yahoos.
Re:Show HN: Sapper.js – towards a better web app framework by Silhouette on Tuesday January 02, 2018 @11:14PM (#16058321)
Well, yes, there are plenty of incompetent developers too, as there always have been since development broke out of its earliest new-and-specialised-job days.

Even so, the idea that not using a framework automatically means you'll produce some poor imitation instead is laughable. The history of software development is replete with examples of people succeeding without those frameworks. We've built countless UIs that way that were much bigger and more complicated than anyone has ever built with Angular or whatever this week's flavour of JS framework is.

Maybe there are only thousands of developers working in the web industry who could do it rather than millions. I'm not sure that undermines my real point, since you'd only need a handful of decent devs to make and maintain almost any web front-end I've ever seen.

I suspect the true problem is that for various reasons we lose a lot of that experience and skill from the industry far earlier than we should, and then yet another young generation of developers who haven't studied history are doomed to repeat it, badly.

Re:Show HN: Sapper.js – towards a better web app framework by antonkm on Tuesday January 02, 2018 @02:05PM (#16054413)
I agree - have yet to see the benefit of using a framework that aren't at least 2 years. Never do client work using newly released frameworks (if that isn't specified as a must by the client). The result will come back to bite you sooner or later.

I like the idea of universal code, maybe Sapper will be the solution that comes out winning. I'll let the community be the judges and hop on the train a year later if that's the case.

Re:Show HN: Sapper.js – towards a better web app framework by rimliu on Tuesday January 02, 2018 @12:31PM (#16053454)
Or it may well be that this "all new web tech" was created by people who do not understand neither web nor HTML. Sudenly everything needs to be SPA, every site needs to load hundreds KBs of scripts just to "be current". What's the value of being modern if it makes user experience objectively worse? Sure client side render may prevent you from reloading the entire page. And who cares that this rerender actually takes longer than reload? Did I really need to waste 200KB of my mobile data to load scripts all I wanted to see were 5 pages each weigthing 5KB? What did I gain from trading full reload for the a-la-SPA kind of deal?
Re:Show HN: Sapper.js – towards a better web app framework by scottmf on Tuesday January 02, 2018 @12:58PM (#16053701)
>Sudenly everything needs to be SPA, every site needs to load hundreds KBs of scripts just to "be current".

Not everything has to be an SPA, but React is 30kb gzipped and Preact et al are in the single digits.

>What's the value of being modern if it makes user experience objectively worse?

The point is they don’t inherently make user experience objectively worse.

>Sure client side render may prevent you from reloading the entire page. And who cares that this rerender actually takes longer than reload?

This isn’t how it works. Rerenders can be incredibly fast.

>Did I really need to waste 200KB of my mobile data to load scripts all I wanted to see were 5 pages each weigthing 5KB? What did I gain from trading full reload for the a-la-SPA kind of deal?

What did you lose? You lost nothing because SSR provided the initial page load as quickly as any other HTML.

It sounds like you’ve generalized the entirety of modern SPA development from your experience of a few terribly developed sites with poor user experience.

You probably only notice the poorly-built SPAs because the UX gets in the way. i.e., confirmation bias.

Re:Show HN: Sapper.js – towards a better web app framework by Nemi on Tuesday January 02, 2018 @02:29PM (#16054665)
> The point is they don’t inherently make user experience objectively worse.

Ah, but they do. Browsers are very mature and predictable in their management of html pages and SPA's break that behavior in subtle, uncanny-valley ways.

For instance, click into the Sapper HN page https://hn.svelte.technology/item/16052558, scroll down to a post with a random link and click into it. Click on another page in that link. Now click the back button in your browser to get back to the sapper page. You find that you will be at the top of the page as it re-renders. You lose the place you were scrolled to.

This does not happen with standard cached html pages in the browser.

One of the worst offenders is google's home page. When clicking into the links looking for something, clicking back will take you to top, again and again, losing your place. This is a big step back in usability that people are not even aware is happening. It is a small thing individually, but in aggregate it adds up to a large thing.

Re:Show HN: Sapper.js – towards a better web app framework by rich_harris on Tuesday January 02, 2018 @06:12PM (#16056790)
> You find that you will be at the top of the page as it re-renders. You lose the place you were scrolled to.

What browser is that happening in? In Chrome it works correctly — Sapper uses `history.scrollRestoration = 'manual'` for this exact reason, but maybe it fails elsewhere? It's a bug, and we should fix it. (This is pre-1.0 software, your forbearance is appreciated.)

Re:Show HN: Sapper.js – towards a better web app framework by Nemi on Sunday January 07, 2018 @04:55PM (#16092962)
Way late on this reply, but it was in chrome. I found that an immediate back button would often work, but if the page you were navigating to was overly large or you clicked into another link or two and then went all the way back it would lose place.
Re:Show HN: Sapper.js – towards a better web app framework by RobertRoberts on Tuesday January 02, 2018 @01:04PM (#16053758)
>You probably only notice the poorly-built SPAs because the UX gets in the way. i.e., confirmation bias.

Maybe you are too young to remember Youtube before it was turned into a webapp. It was _considerably_ faster. Todays version requires all sorts of odd refreshing bits and pieces. The old one just loaded right away and showed the video.

If I was paranoid, I'd think that Google did it on purpose to push Youtube Red ads at us.

Re:Show HN: Sapper.js – towards a better web app framework by boubiyeah on Tuesday January 02, 2018 @03:51PM (#16055495)
Agreed youtube as a webapp brings no value whatsoever. Someone at google wanted to rewrite it with newer techs to update its CV? :)

PS: It downloads that crappy polymer that weights more than 1.5MB... ffs

Re:Show HN: Sapper.js – towards a better web app framework by nine_k on Tuesday January 02, 2018 @01:05PM (#16053768)
"Right tool for the job", as the old saying goes.

There are sites that indeed are applications, with lots of updates occurring dynamically on a page: a chat, a dashboard, any type of control interface. They do benefit from the libraries that make highly dynamic things efficient.

There are sites that are best served as static pages. This includes the server component, too, BTW. A static site generator producing plain HTML + CSS is often a good replacement to something like Wordpress.

Some people use latest trending tech for no good reason, just to show off. But the problem here lies not in the tech used.

Re:Show HN: Sapper.js – towards a better web app framework by goatlover on Tuesday January 02, 2018 @02:38PM (#16054778)
Agreed, don't make SPAs out of sites that work well as traditional websites. Browsers and the internet are fast at serving up html & css these days. Even PHP rendering is pretty damn fast. And it best fits how browsers work for traditional sites.
Re:Show HN: Sapper.js – towards a better web app framework by GordonS on Tuesday January 02, 2018 @01:19PM (#16053919)
Agree with you on this. Many (most?) sites work just fine with the time-tested method of server-side rendering. When taking compression and browser caching into consideration, you are typically not sending much data across the wire after the first page load.
Re:Show HN: Sapper.js – towards a better web app framework by megaman22 on Tuesday January 02, 2018 @12:29PM (#16053434)
Possibly a lot of HN has been around the block for a couple of decades at this point, and has seen this web dev stuff come full circle several times, and before that, the same ideas in desktop software.

Computer science programs really need to introduce something like a "History of Computing Ideas" course as a mandatory element. Maybe we can get away from rehashing the same cycle of trends every five years and move onto some different wheels.

Re:Show HN: Sapper.js – towards a better web app framework by OJFord on Tuesday January 02, 2018 @01:26PM (#16053997)
> Computer science programs really need to introduce something like a "History of Computing Ideas" course as a mandatory element.

Isn't that the whole programme?

In my final year I had a couple of more advanced courses in which we could just about get our heads around results published by the lecturer four years ago when we started the programme. Everything else is just working up to that, from Boole's ideas; through Turing's and von Neumann's.

Re:Show HN: Sapper.js – towards a better web app framework by megaman22 on Tuesday January 02, 2018 @02:47PM (#16054896)
You're looking at this from a more academic perspective than my comment implied. Really, it's the whole clusterf&*^ of software engineering being conflated with computer science, when they are really not the same thing in any way.

There is a lot of practical implementation history that people are often woefully ignorant of, and it leads them to tread the same paths over and over and over.

    - Here are the core GNU command line utilities; make, sed, grep, etc.  They are battle-tested, use them, don't rewrite them a dozen times in JavaScript
    - Here is the progression of version control tools that people have used over time, and some reasons why we've moved on from SourceSafe and rcs to Git.
    - Here's the history of how people have done databases, flat-file, vs sql vs nosql
    - etc, etc, etc.
Re:Show HN: Sapper.js – towards a better web app framework by OJFord on Wednesday January 03, 2018 @04:20AM (#16059614)
Ah, I see what you mean. Apologies, I didn't mean to digress from the spirit of your comment, I suppose it just varies with experience: of the things mentioned, including web frameworks, I _did_ hear of the history of how people have done databases, but other than that GNU tools are just things I used to get the work done, and I learned git through open source. (Though I think it would make a great 'stuff you've learned put into practice' talk: diff algorithms, data structures, etc.)
Re:Show HN: Sapper.js – towards a better web app framework by cookiecaper on Tuesday January 02, 2018 @10:05PM (#16057959)
Yes, though I think we need to diffuse the sentiment via organic cultural osmosis rather than relying on ivory towers to indoctrinate for us (not effective).

Alan Kay frequently laments the direction of the computer industry, calling computing "not-quite-a-field" and "pop culture". From an interview in 2012:

Quote:

----

> Kay: [...] [I] happen to believe in history. The lack of interest, the disdain for history is what makes computing not-quite-a-field.

> Binstock [interviewer]: You once referred to computing as pop culture.

> Kay: It is. Complete pop culture. I'm not against pop culture. Developed music, for instance, needs a pop culture. [...] The big problem with our culture is that it's being dominated [more by] pop-culture content than it is for high-culture content. I consider jazz to be a developed part of high culture. Anything that's been worked on and developed and you [can] [sic] go to the next couple levels.

[...]

> [Kay continues]: [P]op culture holds a disdain for history. Pop culture is all about identity and feeling like you're participating. It has nothing to do with cooperation, the past or the future — it's living in the present. I think the same is true of most people who write code for money. They have no idea where [their culture came from]. [sic - brackets in original]

---

It's a great summary of the programming fads that have come to characterize tech culture and how disappointing it is for anyone who is trying to navigate this field with some intent and presence of mind higher than fitting in with the crowd or cashing in on a perceived gold rush.

It's also just a great memorialization of the concept of pop culture in general; pop culture is about a feeling of belonging and community, and engaging positive biological responses associated with social approval and community. It's something that people do to give themselves that rush of praise, and then retroactively try to justify. After a couple of years, no one can understand what anyone was thinking because they were just rationalizing riding the tide.

And, IMO, it aptly describes not only the React phenomenon, but also Kubernetes (aka "shared hosting"), Docker (aka "static linking"), etc. Also IMO, big dollar players stoke this negative culture because it's profitable for them.

It's not necessarily that these technologies won't leave their mark, it's just that they're not the revelations people pretend they are.

Regardless, suspicion is always warranted when people insist that the contemporary is novel, in computing or practically anything else.

[0] http://www.drdobbs.com/architecture-and-design/interview-wit... \ archive: https://archive.fo/DkQOc

Re:Show HN: Sapper.js – towards a better web app framework by goatlover on Tuesday January 02, 2018 @12:41PM (#16053558)
Are they going to also teach that at bootcamps?
Re:Show HN: Sapper.js – towards a better web app framework by Danihan on Tuesday January 02, 2018 @01:23PM (#16053968)
I'm still waiting for my web framework in pure ASM idea to manifest.
Re:Show HN: Sapper.js – towards a better web app framework by weego on Tuesday January 02, 2018 @02:54PM (#16054961)
I am willing to concede your pedigree as a developer as necessary but I've been writing all manner of languages and environments since 99 and I'm sorry to say there's no revolution here, no battlefield to die on. It's a poor model that has been tried and abandoned any number of times in my career. The ubiquity of platforms that suit these ideas and developers who think Web development began with node and spas isn't confirmation that every idea is the future.

Moreover, the notion that because FB or whoever went "hmm nothing solves our domain problem, we have the resources to solve it ourselves" that suddenly they solved every domain problem is equally naive. It's likely that people quoting react stacks are solving issues that never existed for them with libraries they don't need.

Re:Show HN: Sapper.js – towards a better web app framework by zsck on Tuesday January 02, 2018 @07:25PM (#16057254)
This is an incredibly common stance, and it's also very obviously problematic. No one is saying that your experience in software is invalid or that you're wrong about "these modern frameworks" having been wrong in their time. However, if you aren't yourself working as a frontend developer in a modern startup-ey development environment, you aren't in a position to make so many assumptions about the problems such developers do or do not have. Surely, as professionals and adults, we can all appreciate that we are each dealing with problems in the world for which people believe we deserve to be paid. We all take what we do seriously, and are trying to build the best tools we can to do the best work possible. Even if something comes in as a fad, what good is it to bawk at a perfectly valuable learning experience?
Re:Show HN: Sapper.js – towards a better web app framework by aaron-lebo on Tuesday January 02, 2018 @03:29PM (#16055303)
Your comment expresses a really common sentiment, but it also vague and offers no supporting evidence.

When was a model like React + Redux (or Elm) used previously, and why did it fail? The combination of factors (browser advances and iteration on existing models) is unlike anything before. This tech stack did not exist in 1999, it did not exist in 2005, and it did not exist in 2012. It is driven by real problems.

Re:Show HN: Sapper.js – towards a better web app framework by Silhouette on Tuesday January 02, 2018 @10:46PM (#16058179)
When was a model like React + Redux (or Elm) used previously, and why did it fail?

What do you mean "a model like React + Redux"?

Programmers have been separating underlying state, rendering and interactions since at least the earliest days of MVC in the '70s.

We've been diffing model states to identify changes to act on for as long as we've had explicit isolated state management, which again is several decades.

We've been identifying specific parts of a display to rerender fully because doing the whole thing was too expensive since the earliest graphical video games.

We've been using markup languages to describe UI layouts declaratively for a long time too.

Adopting similar techniques in browsers was likely as soon as serious front-end coding to build larger client-side web apps became viable, and they have much the same pros and cons now as they did in other UI development before. React and its surrounding ecosystem may have been the first JS libraries to popularise the ideas for a new generation, and IMHO those early versions of React were well done and useful, but let's not pretend the underlying concepts are radical and new in themselves.

Re:Show HN: Sapper.js – towards a better web app framework by aaron-lebo on Tuesday January 02, 2018 @11:14PM (#16058322)
Yes, but that's never been attached to a frontend that reaches billions of people.

But like you said, those are good ideas, they didn't fail.

Re:Show HN: Sapper.js – towards a better web app framework by Silhouette on Tuesday January 02, 2018 @11:17PM (#16058338)
Why does the number of people using a UI make any difference to whether the UI does its job well or whether the underlying technologies are appropriate, though? Would any of the arguments for different ways of building UIs change materially if Facebook had a million active users instead of a billion?
Re:Show HN: Sapper.js – towards a better web app framework by aaron-lebo on Tuesday January 02, 2018 @11:27PM (#16058388)
I'm just saying that even with that model before, we never had tech with the reach or capability as we do now, which makes that interesting.

If it was a good model for building UIs in 1970 and it proved itself then, we should be taking advantage of that on the frontend as well, instead of ignoring it.

Re:Show HN: Sapper.js – towards a better web app framework by Silhouette on Tuesday January 02, 2018 @11:38PM (#16058449)
In that case, perhaps our views here aren't so different. I'd agree that React was a relatively rare qualitative step forward in the tools available in web development, precisely because it did bring some ideas and programming styles into the front-end JS community for probably the first time. I just disagree with the idea that this was unlike anything that had gone before, because essentially the same fundamental ideas and programming styles have been used elsewhere in the programming community for a very long time.
Re:Show HN: Sapper.js – towards a better web app framework by scottmf on Tuesday January 02, 2018 @06:29PM (#16056915)
My problem is that every JS-framework story on HN is full of comments either a) showing a lack of understanding of the tech like the parent, or b) bringing up "fundamental issues" with SPAs which are either nonexistent or long-solved.

That isn't to say some concerns might not have merit, but SEO/SSR/shared routing/state/templates are problems with production-ready OOTB solutions.

If someone isn't familiar with the basic SoTA then they should refrain from commenting so harshly on it.

Re:Show HN: Sapper.js – towards a better web app framework by mattgreenrocks on Tuesday January 02, 2018 @06:36PM (#16056963)
The real problem React solves is enabling many people to work on parts of the same page without stepping on each other. The declarative nature is brilliant, but if the messy MVC diagram slides in the reveal presentation are real, then I feel confident in labeling React this way.