Hacker News new | ask | show | jobs
by waitButWhy 2919 days ago
And, as an addendum, all this ties directly into your mention of <img/> versus $ajax();

First of all, that very mindset is the foundation of the bloat we see everywhere else. Complicate a non-problem with a non-solution, because behind the trend is really a desire to shun open standards, in favor of obfuscating intellectual property as an effort to lock user behaviors, and prevent scrapers from ripping off designs that aren't even innovative. An example of the backlash against this sort of thing was the re-adoption of semantic and/or restful URL paths, because so many back-end goons were packing query strings with hundreds of CGI variable parameters, to control page state that no one could paste or email links to each other, and even advertisers started framing a renormalization of URLs under the SEO buzzword, because they saw their page rank taking hits from the drop in sharability.

Second, once you introduce $ajax(), not only does backwards compatibility hang in doubt (as you mentioned) but cross-browser compatibility and forward compatibility may also be sacrificed. Not to mention, you branch into an entirely different area of development. Because in order to make sure everything works everywhere, all the time, you'll need an ajax library, but which one? Choose carefully, you may seal you fate, if the maintainers disappear. Not only that, any JS error for any reason at all, including async resource errors, could kill alllllllllll of your images. So now we need unit tests and a QA team? Is that right? Gee, why not just use <img/> tags, like every browser has supported by default, since... oh... the mid 90's?

1 comments

You make it seem as though AJAX is some unstable, bleeding edge experimental feature that no one ever uses. There's no danger of sacrificing backwards compatibility, or of browsers no longer supporting AJAX in the future.

However, Hacker News does use AJAX, and I don't think it even uses whatever img tag trick OP is referring to. The only img tags on the page are the icon and the vote arrows. If it's there, I couldn't find it.

But read the javascript yourself - AJAX support is just a single, simple function. No unit tests and QA team, no depending on some flaky maintainer. Maybe they do unit tests, I don't know, this place is kind of a black box sometimes.

I think he's annoyed that lots of people are trying to re-implement the wheel using a poor AJAX based solution when an older solution is better, but no one likes using anything "old".
AJAX is not really a new thing, though. It's probably older than some of the developers who complain about it.
It's still implemented differently across different browsers, past and present, and despite being mature it isn't exactly future proof.
Cross-browser AJAX is= a solved problem at this point. You can just go to Stack Overflow or find one of countless libraries to handle it to whatever degree of compatibility you want.

And all code is a moving target - nothing is future proof, especially where javascript is involved, but AJAX seems a lot more future proof than hacking image tags to do something other than loading images. It's baked into front-end templates and the caching strategies of the biggest sites on the web so it's not likely to go anywhere anytime soon.