133 points · by johanbrook · 11y ago · 87 comments
To me, the notion of having strong opinions on particular techniques for web application (or web site) development strikes me as an example of a subfield having an over-inflated sense of self. Web app development and javascript frameworks are a tiny, tiny niche of software engineering which is an even smaller niche of the entire area of the medium of computing. And it's not a particularly interesting one, imho. I'm not sure why so much ink is spilled on it other than it's easy to form opinions around.
Because people read it. And people read it because social cues are important.
When you're going to commit hundreds (or thousands) of man hours to building a system you may have to maintain for years based on very, very partial knowledge, you want to know what other people think about the tools you plan to use.
That's called research. You do it on your own time, while using more mature & proven solutions for daily work. Play with it, review all the source code. Like it or not, it's going to be your code, once you start using it in earnest. Don't treat it like a friendly black box.
Is that too much to do? Then you're going to have a lot of surprises. Maybe that's fun for you, but I have to say it gets really old over the years.
> It requires a certain amount of cognitive dissonance to point to Etsy's 2000 files as a failure while at the same time they are a successful company.
Er, no, it doesn't require cognitive dissonance at all. In fact, the folks at Etsy blogged about the issues themselves.
It's a common thing for a fast moving, highly successful project to accumulate gunk under the excuse of "it works for now, we'll clean it up later". But, if the clean up never comes, that gunk eventually becomes a noticeable drag on daily development.
> And it's not a particularly interesting one, imho. I'm not sure why so much ink is spilled on it other than it's easy to form opinions around.
If it's not particularly interesting, then why are you reading about it and responding to it? :)
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.)
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.
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).
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.
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".
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.
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.
This. Surfing with uBlock with strict javascript settings leads to a surprising amount of broken pages that do nothing with javascript that is mandatory. From graphical gimmicks that get stuck covering the page to breaking buttons on search forms, there is a lot of stuff that could work just fine, without the scripts adding any real benefit.
I get that for more complex use cases there are tradeoffs to be made (e.g. implementing a server-side AND a java-script version of functions, adding dynamic content to staticly hosted pages, ...), but there also are a lot of low-hanging fruit.
wget http://mydomain/myapp
make
run
But with the benefit of running in a (browser's) protected environment .. The above would be OK in linux running jailed, but a possible catastrophe in Windows where you basically run everything with root (although that has and will probably change in later Windows releases).Once the "client" has been downloaded and running, all communications are done via Websockets. So it's no longer a HTTP-application or "REST".
What makes it so convenient is that the user can both download and run the application in ONE click (no install, yet cached). Without worrying about malware, so I don't need their thrust. And the client can run on basically all devices and OS's, so no need for porting.
Actually, it seems the converse is true. Ray Cromwell recently commented[1] regarding Google Inbox:
> It's nothing to do with JS code execution, the problem is in the rendering engine, essentially too much repainting and rendering stalls, and too little GPU accelerated animation paths.
> Javascript is in a very good state these days in terms of cross browser compatibility, and while CSS support has converged between browsers in terms of correctness, CSS support has not converged on performance between browsers. Safari, Chrome Firefox, and IE have wildly different animation performance hazards on the same markup and debugging this often isn't trivial, for example, finding out that the GPU is stalling on texture uploads deep inside of the render loop.
The average U.S. worker spends 4.6 years in a given career, and yet it takes ~5 years to master a framework. The average computer science grad earns much more than a web developer, so the skill set required for proper development is often lacking. Add into the mix cheap offshore labour, poorly made "out of the box" web packages aimed at medium-small business, and inexperienced "geeks" who build poor websites on the cheap.
Given the skill set required for professional level web development is on par with software development, it's no surprise the role isn't getting the skilled people the career requires.
Are we talking about web frameworks? Because it sure doesn't take 5 years to master most web frameworks.
It really comes down to how complex your project is and how integral the framework is to it.
kinda hard when frameworks completely refactor themselves or fall out of style within 18 months
The problem isn't skills, the problem is developers wanting to use their shiny new toys just to show off.It has nothing to do with skills. It's how people use the tools they have at their disposal.
A larger problem in my opinion is the victory of HTML5 against XHTML2. XHTML2 would have solved a whole lot of problems developers are still trying to solve by abusing javascript or writing specs like web components that just look like "the vengeance of XHTML2".
And weren't web components pushed aside to HTML 5.1 since it's not finalized and we wanted to call work on "HTML 5" completed? And I fail to see how XHTML, being simple markup, would do anything to assist with an AJAX call. It's HTML5 that you have to thank for the async and defer attributes for scripts, that reduced some of the need to use anonymous functions to do the same thing. Effectively, HTML5 has been as much about speeding up browsers as speeding up web development--and in the process, the user's happy too because they have no idea what's happening inside their browser, but things stay compatible. After all, no one was updating old sites to be XHTML-compliant and yes, there were too many non-validating sites. So we just stopped worrying about validation as much, as far as XML goes.
5 years of experience with angular wouldn't teach you that there are certain use cases where it should never be used.
This is so common. Lot of time, they use CSS to change the design of the module, which is how it should be. But when they revert the look of the module, instead of deleting CSS, they add new rules to overwrite existing CSS. Which leads to specificity fight and !important.
At my previous job, site was rendering on server. It was old, and we wanted to redesign it. I wanted to keep rendering on the server. CTO and VP wanted to build Angular site because everyone is moving to Angular and its easy to find Angular developers. Company's 30+% of new visitors comes through SEO.
I think I missed the point of your second paragraph, I'd be interested to know what you meant to say. (currently working with Angular on a small hybrid app and thought about experimenting with it on the web but SEO concerns were the first thing that came to mind, so it feels like a relevant piece to me!)
My mobile hacker news client http://hn.premii.com/ ranks top on Google but not because of the content. Content is not indexed by Google.
- JS only site won't rank higher on search engines.
- Facebook share/Open graph won't work
Or any site that relies on getting HTML from you to index wont work.
IMV most people don't understand the tradeoff's they're making when they adopt Angular - I'm seeing plenty of sites that have huge start up times due to them using Angular when they could equally achieve a better experience without it.
All our servers (API/DB) are slow, and they think that Angular will free up resource (Because not rendering on servers), and using "free" client resource to render, it will be fast.
> and pretending that a site is "broken" if it doesn't work for a handful of geeks is being willfully obtuse.
This is the common rallying cry of the 'use-JS-for-everything' camp. The most important reason a user should have an internet-wide blacklist on JS as the default is because the default should NOT be to allow any website ever to run arbitrary scripts on a user's machine.
That's like always running as root while on a development server. No, wait - that's like having random people from the street have root on your server for arbitrary amounts of time, and all you can do is watch. Principle of least privilege certainly applies to the web as well.
Let's not even mention how an open and private web is hindered by orders of magnitude from Google analytics and Facebook like buttons tracking you across entirely different spectra of websites simply because the sites you're visiting has them embedded.
---
EDIT: Can the downvoters please reply with constructive criticism.
If I'm making a game that's not turn-based, going JS-free is literally impossible. For a lot of applications you could in theory make a JS-free version, but it would require making a COMPLETELY separate implementation of the application, and for a lot of people that's just not justifiable. Most people simply don't have the time and resources to achieve this, so obviously they'll favor the larger chunk of users.
For example, let's say I want to make an image editor. I can imagine some ways in which I could possibly implement certain functionality without any JS, but the experience would be ABYSMAL. Seriously, consider implementing even a MICROSCOPIC subset of the functionality provided by Photoshop with JUST server-side rendering.
If you're making a website, I'd say you should try to make it work without JavaScript, and in a lot of cases it can be achieved without that much effort. Blogs, news sites, docs, etc. are typically easy.
However, if you're making an application, I'd argue that it's pretty much impossible to do it without JS. It's possible if you're willing to implement your application multiple times (once in a JS-heavy way, and once in a JS-free way), but that's not feasible for most people. The other possibility is implementing it in a way that's friendlier to JS-free users, but for any non-trivial application that'll lead to a really shitty experience for most users. You just can't do sophisticated interactions when you're making something JS-free.
1) Because a technology fails in the hands of amateurs or learners, doesn't mean the technology is bad.
2) He assumes webdeverlopers don't think about the consequences of a JavaScript only website. In my experience, that's not the case.
3) The fact that there's a lot of talk about JavaScript frameworks does not mean webdevelopers are less interested in the end product. It means JavaScript and everything around it is in flux and improving every month. And the decision which framework to pick is very important. It can mean the difference between a stalled or thriving end product one year later.
> "That is the great thing about web technology. It isn’t clean or well designed by a long shot — but it is extensible and it can learn from many products built with it."
That _was_ the great thing about web technology: 'worse is better', but it is no longer an aspirational goal. As a developer I need a well-designed web to build on, and these modern frameworks are doing exactly that.
> If we do everything client-side we do not only need to deliver innovative, new interfaces. We also need to replicate the already existing functionality the web gives us. A web site that takes too long makes the browser show a message that the site is not available and the user can re-try. When the site loads, I see a spinner. Every time we replace this with a client-side call, we need to do a lot of UX work to give the user exactly the same functionality.
There is no "Loading" spinner anymore on a well-built JS-heavy application. Good frameworks (React, Ember with FastBoot) use Javascript on the server to send a fully rendered HTML to the client. That works. And they rehydrate this HTML with JSON data and client-side logic so that any further JS interaction is smooth and can be done using the conveniences of the framework.
But if were to follow the gist of what the article is trying to tell us, we should instead be rendering HTML using typical server-side technologies, and use progressive enhancement to add dynamism in the client. This is not a good solution: we have to duplicate rendering logic on both the client and server using two completely different stacks. It is a lot of cognitive load, needs duplication of effort, and is a maintenance nightmare.
A better solution is to simply render everything using Javascript, and remember that Javascript is no longer a client-side technology. Use the same Javascript to render contents both on the server and the client and rehydrate the rendered HTML transparently on the client.
I also disagree with the author's implied assertion that people who use conveniences like SASS do it more because of incompetence in wielding CSS. The kinds of abstractions CSS promotes are selectors, specificity, and cascade. They are not the kind of abstractions one needs to build a maintainable and reusable body of code. We programmers know what they are: variables, modules, objects, control structures, expressions.. SASS provides some of those missing pieces: variables, mixins, conditionals and expressions. In fact SASS pushes CSS closer to a programming language than CSS is, and that is a good thing.
The article closes on this note:
> A lot of our work on the web goes pear-shaped in maintenance. This is not a technology issue, but a training one. And this is where I am worried about the nearer future when maintainers need to know all the abstractions used in our products that promise to make maintenance much easier. It is tough enough to find people to hire to build and maintain the things we have now. The more abstraction we put in, the harder this will get.
I'm as close to an abstraction-hater as the next person. But there are good abstractions and bad ones. Mutating DOM directly using spaghetti Javascript? That is just no abstraction. Once we understand the rendered view as a function of state, then it makes sense to have abstractions based on that idea (like one-way or two-way data binding).
The need for training is not a point of contention. But assume we have competent developers working in good faith, and they still find it hard to write well-maintainable code for the web, then it has to be something else that is broken. Having used these newfangled frameworks for a while now, I do think that is very much the case. Anyone should be able to put together reasonably written web-apps without being masters at the craft, but it has so far been hard, not because of people, but because of tools.
One issue is: plain old HTML and CSS are better tools for regular people to deal with to lower the barriers to wider participation in the web. Having to learn JS to make sense of a website is an extra burden.
To me, it comes down to: see all the complaints about brokenness when client-side JS fails or is off. Building things with client-side JS as a requirement is unacceptable. Now, ignore client-side. Can you actually make the case that server-side JS is superior to other frameworks and languages? It shouldn't be used just because it's the same language as the client-side enhancements. If it's not the best option server-side, go with the better options instead. But I don't know enough myself to make that judgment, I'm just talking about the way to think about it.
I agree this is more about people not caring about all possible use cases because they focus on the performance of just one browser or just one platform to get a working app. It's hard to move from working proof-of-concept app to a fully-developed product that you can build on in future that is entirely multi-device and cross-browser. Then once the technical details are in place, ask yourself if you're building "the right product" and you really do need an entire team.
I'm not entirely sure I'd blame over-reliance on client-side programming however. To me that's a symptom not the cause. It'd be like blaming CSS Media Queries for the fact that most mobile sites purposefully hide functionality and are less useable on phones than their desktop counterparts. The problem isn't the technology in as much as it's a lack of understanding in how it can be best applied.
There is progress however. It used to be we had lots of websites putting text in images, using tables for layouts, or using JavaScript for interactive drop-downs. It's nice to know that as an industry, over a decade, we moved from 0% CSS to everyone using CSS and perhaps over-using it. I'm sure within the next decades we'll see an emphasis on all good practices, until the point where the web is again unrecognizable: just as today's developers probably wouldn't know where to start with spacer.gifs, it's possible in future we'd question anyone who doesn't serve pre-rendered HTML with modular JS serving for performance reasons. Either that, or SPDY makes it all unnecessary. I'm of two minds ;-)
You're right about server-side JavaScript-- there are so many more useful features in other languages, and things are more expressive (I like Lisp and Groovy, for instance). But the beauty of server-side js is that it's our esperanto. I'm interested in seeing a new generation of kids and senior citizens participating creatively on the web. But in order to do that, we need to standardize to a single programming languages across use cases, disciplines, and preferences. And JavaScript, whatever you think of it, is the best opportunity we've had.
If server-side JS is "our esperanto" that's damning with faint praise. Esperanto is not a universal language, it doesn't fill any actual need, and it hasn't encouraged more people to read or write.
From time to time, I found the idea in Gary Bernhardt's talk, The Birth and Death of JavaScript /pronounced as yah-wa-skript/, despite being very hilarious per se, was also very insightful.