by sarciszewski · 11y ago · 0 comments
If you are a developer, you shouldn't rely on Javascript. Yes, feel free to use Javascript to make things sexier, but the use cases where a web page should require Javascript to render properly has substantial overlap with the "we didn't think things through" slice of the Venn diagram.
If your page is unreadable with NoScript and RequestPolicy turned up to maximum paranoia, your webpage is broken.
If you're building a client-side application rather than just a web page, then it's okay if turning JS off breaks your app.
I guess what I'm getting at is as I've gotten older I've grown less and less empathetic to arguments that seem to appeal to an engineer's sense of purity, correctness, and craftsmanship and not much else. Tie it to user pleasure, effectiveness, business metrics, anything, but citing the idea that somehow since the web was not designed with Javascript everywhere in mind meaning we should use it as the exception not the rule isn't much more than appeal to tradition argument to me. There are definitely areas of software engineering where you can find many examples where a lack of respect for the craft, or a lack of knowledge of history/standards results in failure, but I'm just not buying the idea that if you build a SPA with a fancy new javascript framework instead of making sure NoScript works you're somehow going to be paying for that in spades down the road because it's breaking some set of rules handed down by the high priests. There are about a million other technical decisions that have more of an impact in a serious project. (For example, instead of arguing about SPA vs non-SPA, or what framework, or whatever, ask yourself: "Is anyone on the team an expert in any particular flavor of this?" If the answer is "yes", then going with any one of those is almost certainly the best strategic decision regardless of the supposed merits or flaws of that particular approach.)
* Bug accidentally makes it into production, preventing some crucial feature from working? JS just got disabled.
* User is browsing your site with an old device that doesn't support a feature you make use of? That JS has been disabled.
* CDN fails and your fallback mechanism isn't working like you thought it was? JS got disabled.
Not saying these are common occurrences, but I've seen all of them happen.
I'd say yes. Usable != profitable. Hey, HN is broken, because it will "time-out" pages and you will sometimes get an error when clicking "next" - but that doesn't make it useless. (and for the arc apologists that usually respond to this - I clicked a valid link on this website, I don't care what technology is HN based on)
Also, your website would be broken if it was unusable: under anything other than IE, on machines other than PCs, on devices not made in Asia, by people older than 60, etc. None of those prevent it from generating millions of dollars.
Then again "broken" doesn't mean you should care. If your goal was just to make millions of dollars, that's fine. Just don't be surprised people call it broken.
Outside of websites: Private healthcare is broken in the US, but works for N% of people who can afford it. Many people live with the status quo. Is it meaningless to call that system broken? If it's a high enough percent, why care about anyone calling it broken? [my answer - because we're aware it could be better, but it requires more work]
Maybe they're a small percentage of your users, but it still strikes me as a dick move in the same category as constructing a building that isn't handicap-accessible (yes, I'm aware there are legal compliance rules in the building trade).
The reality is that very few screenreader users disable JavaScript [2] surprise! they're much like any other user). A properly coded SPA, using aria-* properties is as accessible to most AT users as a traditional server-side application.
13%, actually, globally. 2% in the US (population of NYC):
http://www.searchenginepeople.com/blog/stats-no-javascript.h...
That doesn't even count people who use browsers which you haven't tested with obscure bugs, or people who have laggy and slow connections that also breaks or damages the functionality of your javascript heavy web app.
I explained why. For people who use browsers who you haven't tested which break the JS in obscure ways, not to mention people whose experience breaks in obscure ways because of dropped packets and high lag.
>Beyond that, website populations have bias and as such citing national/global stats is at best a first order approximation
Ironic complaint from somebody whose first guess was two to three orders of magnitude off.
All users don't have the same value. And it's also about trends.More and more users use addons that block javascript by default,just like more and more users use adblock. You might not care today,but when it's time to care, well your competitor that cared will get the users and the revenue lost because "you didn't care".
supporting no script is as simple as not abusing javascript in the client.I fail to see how you'd spend more man hours when not investing in these full client-side javascript frameworks when your product can work without using javascript to begin with.
Do you have any data to back that up? In my experience it seems like the number of people who turn JS off by default has declined since SPAs became so common. It looks like the search trend for Noscript has been gradually declining since 2009, while Adblock has risen: http://www.google.com/trends/explore#q=noscript%2C%20adblock...
It's better to pre-load actual content, or if you don't have that, fake content, then to show nothing at all.
Similarly, it's better to pay attention to back buttons so your users can navigate a website using built-in controls. This is especially important on phones, where it's easy to click a wrong link, and where back is literally a button.
Can you do this with JS? Yes. Is it obvious? Not always. The same was true with our use of CSS over images, or web fonts over flash. Eventually the industry will move in the right direction, it just takes time and the occasional rant or two. ;-)
I'm sorry but I think he's saying something a little to the left of that. His overarching point about javascript seems to be that it adds complexity to any application - suddenly, page loading indicators and all application states must be handled intelligently by us, developers. His point here is that we already have an issue with developers working on code they don't have the experience, ability or time to understand. SPAs and anything else lead to a serious requirement for developer discipline.
I think some important points were, in my own words:
- Choosing a technology stack doesn't matter
- Choosing a framework doesn't matter
- What the application does and how it behaves is all that matters. Choose any tech stack that will do the job.
- No matter what tech stack you choose, your app will run into issues. It will need maintaining.
Like he says:
> What a good app needs is a team of dedicated people behind it. Good apps are good because talented people cared about them and pooled their skills.
- No amount of abstraction will help. If the abstraction is not understood, it will also hurt.
But please feel free to agree or disagree with me. I'd love to know what you all thought.
The platitude about needing a "talented", "passionate" team is vacuous and meaningless. You might as well write the key aspect of a good app is very little bugs. Absolutely meaningless statement. It's very obvious a bad developer with a good framework will lead to bad output; no need for a 5000 word article on it.
"What the application does and how it behaves is all that matters."
I'm hard pressed to find a rebuttal to this, if only for the reason that implementation is the goal. No one will ask you to write an application in Python, "and who cares what it does". The very opposite is true - no one cares what it's written in as long as it's the necessary implementation.
From here I would like to address my "point" that tech stack and framework don't matter. I think that we're actually on the same page here save for some sloppy wording on my part. I concede that on a per-project basis framework and stack matter. They quite clearly do, and I agree with you.
I would still like to argue that they don't matter as much as we like to think. To use the example you gave - PHP - depending on your purpose, your required implementation, PHP is still a powerful and useful tool. It's easier to work with than many other technologies for certain kinds of solutions. At the same time, it might be a better idea to write a solution on Rails for any number of reasons. These are specific to each project. At the end of the day though, you can successfully implement any number of solutions on a great many different stacks with no great change to implementation. I can write an application and use either PHP or Rails for the backend, Angular or Backbone for the frontend framework if I have one, and for the end user there will be ultimately no difference. I can run a PostgreSQL or a MongoDB database and they won't be able to tell the difference. If this is the case then, what makes a good application? It is the people writing the code, architecting, and meeting the challenges in ways that work with the chosen frameworks and technology stacks. It seems to me that the end result, then, is reached by people and not by stacks or frameworks.
Sorry for the long reply. No harm if you don't reply to it.
You can write the same web app (from the user point of view) using Python, Ruby or PHP (frontend: jquery, backbone, angular). I do not disagree with this. However, the choice of frameworks is still very important and will determine your speed of development and any future maintenance.
Saying frameworks are irrelevant since they have the potential to all lead to the same outcomes seems a bit much. Any turing complete language can implement program as another turing complete language, but why do we have assembly vs Java vs C vs Python? Higher level programming languages and frameworks are for the human brain. It turns out the the human brain grasps some concepts better than other concepts: we call the more intuitive concepts abstraction.
Using a system that spits out JS and saves me time and effort is a win. Why should I trade that out?
I agree for some users, a properly gracefully degrading system is nice. I like when sites I use are properly URL-based, when I can share links and they just work. But that's rarely a reason I'll switch sites.
So until there's some solid evidence that relying on JS translates into lost money or other serious damage, it's simply not worthwhile and declaring such things broken by fiat accomplishes nothing.
Building a broken web page is fine if you choose to build it that way. If 1% of people can't see your site, or 10%, or even 99%, then that's your choice as a developer. If I want my business website built with WebGL, asm.js, HTML5 audio and WebRTC then that's ok. I'm allowed to do that even if you can't render it. As a user you have no implicit right to use a given website if your choice to turn something off or to use a browser that doesn't support something means it won't work for you. To draw an offline analogy, I have no right to build an application if I choose to remove make from my computer.
There are exceptions - users who need special access technology like screen readers should be protected from developers who build in ways that mean they're put at a disadvantage for example - but ordinary people who choose not to use something like js have no such protections. Using a screen reader is usually not a choice.
I wouldn't even say that this was necessarily true. Client side applications that can be made perfectly functional without JS should be made functional with JS.
I don't want my online banking website or my tax return web apps to use javascript at all. They do, though.
The fact that people make blogs, whose only real function is to serve static text, render with javascript is nuts.
The idea of no JS gets worse when you start applying the idea of just making an API, then having the client just use those APIs, whether they're browsers, backend systems or mobile clients.
Requiring two separate client UIs to accommodate no-JS is unlikely to be a worthwhile cost for many sites/applications.
My bank should not create a site that requires javascript at all.
It increases the attack surface, it increases the likelihood that there will be bugs lurking and it increases the likelihood that the site will fail under circumstances where the user has low bandwidth and lots of dropped packets.
Furthermore, it is not necessary for a working site that does everything that I want. At all. So what is the point??
>The idea of no JS gets worse when you start applying the idea of just making an API, then having the client just use those APIs, whether they're browsers, backend systems or mobile clients.
Which I would not advise doing under any circumstances. Sharing common REST APIs between browser, backend systems and mobile clients sounds like a great idea until you consider that they all require different modes of authentication, authorization, access policies and security features and the like. Are you going to force your backend systems to authenticate using cookies and use the same CSRF protection?
Having separate APIs need not mean that you duplicate a lot of code, so I don't see the need to try to accommodate multiple different use cases using the same APIs.
>Requiring two separate client UIs to accommodate no-JS is unlikely to be a worthwhile cost for many sites/applications.
Requiring JS for many sites/applications is unlikely to be a worthwhile cost, especially considering the additional testing required to make it work equivalently well to a non-JS enabled site/application.
So in short, if a JS-oriented banking website results in a user being able to do their banking more quickly, this is a real benefit and is "the point." You can argue it is not worth the tradeoff, but it's a bit odd to first admit you don't see the point and then go on to say it's not worth it. If you don't see the point, how can you make claims about if it's a valuable thing to be doing? If a bank has 50k daily active users and it shaves 1-2 minutes off of their individual session times, you're looking at saving approximately 50 days of time for people every day. And most banks probably have way more than 50k daily actives. Combine this with other potential benefits like users being able to get enough done in a single banking session to avoid a second visit later, or the user interface being less confusing since users can fall back on desktop metaphors, the amount of saved effort could become truly staggering, worth the additional risk and engineering time of developing a SPA-based solution.
As far as security on the API, I'm not convinced. Don't use cookies for authentication -- is that a big problem?