Live data from Hacker News

Progressive Enhancement Is Dead

tomdale.net

171–180 of 263 posts

Re: Progressive Enhancement Is Dead

#171
post #126

Earlier quoted context omitted.

Well, philosophically, I think having static content served in a backward compatible way is perfect. Pragmatically, I haven't found a good solution to do it without duplicating all the code. That by itself might be a very good reason as to why one would focus the development efforts on the 95% of users. You say people like me . I'm more agnostic here.. just interested to understand the arguments of both side. I just…

What duplication? Why do you need to use js to render text? I'm not saying that a user without js should expect all, or any of the bells and whistles. But to use client side js rendering to show a user a paragraph or two (like blogger), or literally a sentence (when twitter did client side rendering) is just insane. It breaks stuff, and is MORE work than just doing it the right way.

Well, without getting into details and irrelevant domain specific examples, let's say you want to load new content as you scroll down.

---------------- HTML static content way:

1. The new content will be fetched using ajax. Already some problems. From the server-side rendering, it needs to fetch it from the DB, then load it in the template. Using django, for instance, the view will fetch it and we'd show it using {{variables}}.

However, to fetch the data using ajax, it's not just the view making a query, it needs to have an API standpoint, i.e. /api/fetch-new-data/. So, already, the code is duplicated. Yes, the server-side could use the same API, but there's always the problem of returning JSON vs django-ORM-queries, etc.

2. Once the data is fetched (say in json), it needs to be rendered. How? Do you simply do a

    $.get('/api/whatever', function(data) {
        $('.some-div').append('

' + data + '

'); });
It's fine if it's just a

. But usually we'd have a more complex html and thus we'd be using client-side template. So, the server-side templates need to be duplicated. There are various ways to do it, varying from complexity, but there is clearly some duplication here. And, bear with me, it's usually not a simple .append, more javascript needs to be done which can alter the data, etc.

------------------------- Javascript way

1. Load pure html. 2. Fetch initial data and render it using client-side template. (It can also be bootstrapped since it's in the same JSON format). 3. On scroll, fetch more data, and render it using the exact same code / client-side template. ----------------------

Lastly, bear with me that it's just a simple example. It's rarely 100% static content only. I.e. there would be forms with error validation, etc. If you want to do it the no-javascript way, you need to have it submit, reload the view with validation error, etc. Only then, you can add some javascript to enhance it. Contrast that to simply validate on javascript submit. Yes, obviously, the server needs to validate it, but that's part of the api, nothing needs to be re-rendered.

All in all, if you agree that the same code would do the pre-loading and the dynamic real-time stuff, you usually save yourself lots of headache and complexity.

I believe blogger had that problem as they show different views for the same content. When you switch between views, it dynamically updates it in javascript, rather than doing a page reload. Could it be made better by having a html/css content for no-js browser, sure thing. Would that duplicate the code? Sure thing. And again, there are different varying of complexity. Maybe that example wouldn't be too complex, but it's more code to maintain, to test, etc.

It's a bit late here, but hopefully you understand what I mean. And by the way, I'm still not 100% certain about what's the best approach. I know that I used to be pro html static first for backward compatibility and no-js users, and only javascript to enhance the page. But recently, I've tested it by doing it in javascript on the client and it's seriously so much faster and cleaner.

And yes, there are some good frameworks to deal with the duplication, but it adds lots of complexity. For instance, see airbnb Rendr which try to solve that exact problem that I'm talking about. I.e. being able to load backbone.js on the server during the pre-rendering stuff.

Re: Progressive Enhancement Is Dead

#172
You can have your hypermedia on api. and then your AngularJS or whatever on app., consuming your api. Then all you need to do is serve HTML from your api when the User-agent accepts html (bonus points: set a canonical meta tag pointing to your foshizzle app so you don't lose SEO).

Best of both worlds.

PS: All this crazy talk stems from the fact Javascript created an apartheid on the web. We need to make a clear distinction between the HTTP-web and the Javascript-enabled-web. The fact the same software (browser) serves this dual purpose adds to the confusion and allows bad architecture decisions, interwinding content and rich interfaces inside the same hypertext mudball.

Re: Progressive Enhancement Is Dead

#173
... the browser transformed from being an awesome interactive document viewer into being the world’s most advanced, widely-distributed application runtime.

If only that were actually true. In reality, we're designing the interfaces for these applications using a presentation language made basically for desktop publishing. For interactivity, we essentially have one more or less shite language (http://bonsaiden.github.io/JavaScript-Garden/) to choose from. We're still arguing over the very basics on whether we should use callbacks, promises, generators, etc. for simple sequential operations. Hell, we're still trying to figure out how to get a reasonable call stack record to debug when working with any of these options. And God help you if you want to use a modern language that compiles to Javascript and have your debugger too.

But to address the author's original point, I think progressive enhancement is alive and well. While the majority of browsing is done on the desktop, I just think it makes way more sense to think first about presenting your basic content and then enhancing it than how you're going to strip out all the bells and whistles to get your design across on less capable platforms. In the long run, the former will probably save you more time and QA effort. It's just more natural to think about using capabilities when present then working around their absence.

And no one says your baseline should to a screen reader for all possible web apps. Just pick a the baseline that makes sense for what your doing, and enhance from there. At some point, it may make more sense to fork your platform and have separate implementations for different pieces of your interface. It doesn't have to be one monolithic project that magically enhances from mobile phone screen reader all the way up to VR cave.

Re: Progressive Enhancement Is Dead

#174

Earlier quoted context omitted.

What, exactly, is the issue with writing a simple content site that requires JS? If you aren't pulling in half a MB of JS, but it does require scripting to function, I don't see the problem. Just because I could spend the effort to be progressive doesn't constrain me to have to do it. It doesn't make me a lazy programmer either: just pragmatic. 99.99% of the people visiting my site have JS enabled and I'm happy to su…

"99.99% of the people visiting my site have JS enabled" Do you know that for a FACT, or are you just guessing?

His javascript based analytics software has all the numbers.

Re: Progressive Enhancement Is Dead

#175
post #74

There are dinosaurs like me who use the web mostly for reading stuff on websites. I also happen to use an old, quite slow computer as my default machine. It aggrevates me when a site that I try to open because of its textual content takes 30 seconds to render since there's too much Javascript going on. Then I'm typically sitting there thinking: "how hard can it be to display a piece of text?" Because of this, when I…

In all honesty, why should I care about you, the tiny minority? Why should I waste any time at all worrying about you?

Well, everybody is in some kind of minority... But that's not the point.

Are you sure about your numbers? How do you know that people with javascript disabled are a minority? Or, more specifically, how do you measure that without requiring javascript?

I'm all for making web applications that need javascript. But let's do it for the right reasons, not because "everybody has javascript installed".

Re: Progressive Enhancement Is Dead

#176
post #68

Earlier quoted context omitted.

A minority that is growing quite fast , people are not stupid prepare for the javascript backlash like Flash hate wave. If your content is not worth it , if i need javascript just to read some text , if you dont explain why i should turn javascript on with a noscript tag ,then you'll lose me and many more as an audience.

Do you have any statistics to back up your assertion that it's growing? From what I've seen from my own anecdotal experience, as well as from access logs from past places I've worked, this minority is vanishingly small ( Regardless, there is no right or wrong answer in general, there is only the right or wrong answer for your particular website/market. If a significant number of the users you want to support have JS…

How do you differentiate a user using NoScript from a bot dismissed as a browser?

If just I look at my logs, more than 90% of the access are from Firefox and don't run Javascript.

Re: Progressive Enhancement Is Dead

#177
post #162

Earlier quoted context omitted.

No hard bound, but the tape is only potential infinite. (Compare https://en.wikipedia.org/wiki/Actual_infinity )

I don't see that that actually has any bearing on what I said, though. Reality will always give some hard bound, on any practical problem.

Not if you are prepared to buy more RAM (or disk space for swapping) as the program is running.

Re: Progressive Enhancement Is Dead

#178
If you live somewhere with a decent internet connection and don't travel often you may have forgotten that lots of places still have slow or unreliable internet connections. Most of those people probably have JavaScript enabled too, but every extra request required to use the site is a point of failure.

I'll be the first to advocate requiring JavaScript when doing so significantly increases value, but for content sites please at least include the main content directly in the HTML.

Re: Progressive Enhancement Is Dead

#179
post #74

There are dinosaurs like me who use the web mostly for reading stuff on websites. I also happen to use an old, quite slow computer as my default machine. It aggrevates me when a site that I try to open because of its textual content takes 30 seconds to render since there's too much Javascript going on. Then I'm typically sitting there thinking: "how hard can it be to display a piece of text?" Because of this, when I…

You're in a demographic that clearly chooses not to spend money or doesn't have any money to spend, which is not attractive to people trying to make money on the internet. I'm guessing government sites would be the only sites that are interested in serving you.

Re: Progressive Enhancement Is Dead

#180
post #8

Earlier quoted context omitted.

Check out meteor.js for why JavaScript would be needed for "static only content". Real time updates. That's why. Everything is an app.

Maybe I'm getting old but sometimes I really really don't want real time updates.

You want to keep hitting refresh, refresh, refresh?
Post reply on HN