<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Excessive JavaScript and AJAX: bad practice &amp; broken pages</title>
	<atom:link href="http://stevenbenner.com/2010/01/over-use-of-javascript-and-ajax-bad-practice-and-broken-pages/feed/" rel="self" type="application/rss+xml" />
	<link>http://stevenbenner.com/2010/01/over-use-of-javascript-and-ajax-bad-practice-and-broken-pages/</link>
	<description>Random articles about programming, computing and the internet.</description>
	<lastBuildDate>Sat, 14 Jan 2012 08:07:37 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Jake</title>
		<link>http://stevenbenner.com/2010/01/over-use-of-javascript-and-ajax-bad-practice-and-broken-pages/#comment-31130</link>
		<dc:creator>Jake</dc:creator>
		<pubDate>Wed, 27 Apr 2011 22:01:59 +0000</pubDate>
		<guid isPermaLink="false">http://stevenbenner.com/?p=172#comment-31130</guid>
		<description>This sentence:

&quot;Forcing users to download 81kB of script just so you can $(&#039;a#next).click() is a complete waist.&quot;

has 2 errors in it:
  $(&#039;a#next).click()  should be  $(&#039;a#next&#039;).click()
  &quot;waist&quot; should be &quot;waste&quot;

Other than that, great article. I agree completely with what you said here (too often sites will use too much JavaScript (Twitter and Facebook are near the top of the list), and it can really harm the user experience).</description>
		<content:encoded><![CDATA[<p>This sentence:</p>
<p>&#8220;Forcing users to download 81kB of script just so you can $(&#8216;a#next).click() is a complete waist.&#8221;</p>
<p>has 2 errors in it:<br />
  $(&#8216;a#next).click()  should be  $(&#8216;a#next&#8217;).click()<br />
  &#8220;waist&#8221; should be &#8220;waste&#8221;</p>
<p>Other than that, great article. I agree completely with what you said here (too often sites will use too much JavaScript (Twitter and Facebook are near the top of the list), and it can really harm the user experience).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fredledingue</title>
		<link>http://stevenbenner.com/2010/01/over-use-of-javascript-and-ajax-bad-practice-and-broken-pages/#comment-11703</link>
		<dc:creator>Fredledingue</dc:creator>
		<pubDate>Fri, 03 Dec 2010 01:15:27 +0000</pubDate>
		<guid isPermaLink="false">http://stevenbenner.com/?p=172#comment-11703</guid>
		<description>The best practice is to do it server side because, there you are sure it will work as tested. With Javascript you never know how the client&#039;s browser will react.

Also you have operations obviousely suitable for the clients and others for the servers. It&#039;s not difficult to know which ones.

But the best practice is still to keep things simple. To ask yourself &quot;is this realy necessary?&quot;.</description>
		<content:encoded><![CDATA[<p>The best practice is to do it server side because, there you are sure it will work as tested. With Javascript you never know how the client&#8217;s browser will react.</p>
<p>Also you have operations obviousely suitable for the clients and others for the servers. It&#8217;s not difficult to know which ones.</p>
<p>But the best practice is still to keep things simple. To ask yourself &#8220;is this realy necessary?&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Benner</title>
		<link>http://stevenbenner.com/2010/01/over-use-of-javascript-and-ajax-bad-practice-and-broken-pages/#comment-10357</link>
		<dc:creator>Steven Benner</dc:creator>
		<pubDate>Sun, 21 Nov 2010 21:55:02 +0000</pubDate>
		<guid isPermaLink="false">http://stevenbenner.com/?p=172#comment-10357</guid>
		<description>I completely agree that there are times when offloading some work to the client side can be a real help.

For example, I&#039;ve had to do this with portable ad calls before. We needed to show a random subset of the data to users (5 random ads) on every view, but the ad calls are hit so much that doing a random select for every hit was simply out of the question. To make this scale we did a random select of 50 ads and cached the results server-side for 10 minutes. Then on the client side I select 5 random ads from that data. The users see different random ads but I only need to query data once every 10 minutes, instead of querying data for every single hit.

This was a compromise I had to make to get this feature to scale and support the traffic.

However, in my experience cases like this are fairly rare. This had to be a JavaScript call to begin with, so there wasn&#039;t any lost usability. A vast majority of the time the best practice is to do the work on the server and implement server side caching. Even highly dynamic web apps can use caching. In a very high traffic environment, even a thirty second cache might save you hundreds hits to the database. And will appear no less dynamic to the users.

But as you said, it&#039;s a judgment call. I guess I should point out that my golden rules can be bent or broken in places. But it&#039;s best practice to avoid it unless necessary.

What I was ranting about in this article was web developers who use JavaScript and AJAX, not as a tool to enhance the app or make it scale... but simply because they can. I don&#039;t like seeing complete JavaScript dependence on front-facing web sites just because someone thinks it&#039;s &lt;em&gt;cool&lt;/em&gt;.</description>
		<content:encoded><![CDATA[<p>I completely agree that there are times when offloading some work to the client side can be a real help.</p>
<p>For example, I&#8217;ve had to do this with portable ad calls before. We needed to show a random subset of the data to users (5 random ads) on every view, but the ad calls are hit so much that doing a random select for every hit was simply out of the question. To make this scale we did a random select of 50 ads and cached the results server-side for 10 minutes. Then on the client side I select 5 random ads from that data. The users see different random ads but I only need to query data once every 10 minutes, instead of querying data for every single hit.</p>
<p>This was a compromise I had to make to get this feature to scale and support the traffic.</p>
<p>However, in my experience cases like this are fairly rare. This had to be a JavaScript call to begin with, so there wasn&#8217;t any lost usability. A vast majority of the time the best practice is to do the work on the server and implement server side caching. Even highly dynamic web apps can use caching. In a very high traffic environment, even a thirty second cache might save you hundreds hits to the database. And will appear no less dynamic to the users.</p>
<p>But as you said, it&#8217;s a judgment call. I guess I should point out that my golden rules can be bent or broken in places. But it&#8217;s best practice to avoid it unless necessary.</p>
<p>What I was ranting about in this article was web developers who use JavaScript and AJAX, not as a tool to enhance the app or make it scale&#8230; but simply because they can. I don&#8217;t like seeing complete JavaScript dependence on front-facing web sites just because someone thinks it&#8217;s <em>cool</em>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: st33d</title>
		<link>http://stevenbenner.com/2010/01/over-use-of-javascript-and-ajax-bad-practice-and-broken-pages/#comment-10209</link>
		<dc:creator>st33d</dc:creator>
		<pubDate>Sat, 20 Nov 2010 11:03:25 +0000</pubDate>
		<guid isPermaLink="false">http://stevenbenner.com/?p=172#comment-10209</guid>
		<description>&quot;Do not use JavaScript when server-side coding can accomplish the same thing.&quot;

This is a nice idea until you have over a million visitors a month like we do. Then your server is screaming in pain and your hosting costs shoot through the roof.

We found this out the hard way. Q.E.D.

Balancing the load of server side cpu and client cpu is a judgement call. Not a rule.</description>
		<content:encoded><![CDATA[<p>&#8220;Do not use JavaScript when server-side coding can accomplish the same thing.&#8221;</p>
<p>This is a nice idea until you have over a million visitors a month like we do. Then your server is screaming in pain and your hosting costs shoot through the roof.</p>
<p>We found this out the hard way. Q.E.D.</p>
<p>Balancing the load of server side cpu and client cpu is a judgement call. Not a rule.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fredledingue</title>
		<link>http://stevenbenner.com/2010/01/over-use-of-javascript-and-ajax-bad-practice-and-broken-pages/#comment-9773</link>
		<dc:creator>Fredledingue</dc:creator>
		<pubDate>Mon, 15 Nov 2010 00:43:31 +0000</pubDate>
		<guid isPermaLink="false">http://stevenbenner.com/?p=172#comment-9773</guid>
		<description>Hi, I appreciate that finaly someone says something about excessive use of javascript (not only AJAX).
Famous websites, and especialy &quot;News&quot; websites, are full of tons of scripts sometimes extremely slow.
The more famous the more crappy and bloated they are.

I can&#039;t understand that because these scripts have, 99% of the time, no reason to be whatsoever. If you disable scripts totaly, everything is still there identical or almost.

So why do they do that? Web designer hubris? Obsession on automation? Non monitored self-generating code?
Anyway, how much time and money have been waisted to code this crap is beyond me.

Even if these codes are autogenerated by several separate entities, and multiplied without purpose just because nobody thought of deactivating them, still someone had to code them one day. Who did all these huge useless and terribly inneficient scripts, must be either maniac, schyzophere or something. So are all the webdesigners js maniacs like that? Why all the big companies and news sites hire them?
What do these companies managers wanted exactely with their websites? Sure, not &quot;please write me a 5000-lines js code for the sake of coding&quot;! I can&#039;t even figure out the goal of these projects. Advertisement, of course, but why like this?

Regards.</description>
		<content:encoded><![CDATA[<p>Hi, I appreciate that finaly someone says something about excessive use of javascript (not only AJAX).<br />
Famous websites, and especialy &#8220;News&#8221; websites, are full of tons of scripts sometimes extremely slow.<br />
The more famous the more crappy and bloated they are.</p>
<p>I can&#8217;t understand that because these scripts have, 99% of the time, no reason to be whatsoever. If you disable scripts totaly, everything is still there identical or almost.</p>
<p>So why do they do that? Web designer hubris? Obsession on automation? Non monitored self-generating code?<br />
Anyway, how much time and money have been waisted to code this crap is beyond me.</p>
<p>Even if these codes are autogenerated by several separate entities, and multiplied without purpose just because nobody thought of deactivating them, still someone had to code them one day. Who did all these huge useless and terribly inneficient scripts, must be either maniac, schyzophere or something. So are all the webdesigners js maniacs like that? Why all the big companies and news sites hire them?<br />
What do these companies managers wanted exactely with their websites? Sure, not &#8220;please write me a 5000-lines js code for the sake of coding&#8221;! I can&#8217;t even figure out the goal of these projects. Advertisement, of course, but why like this?</p>
<p>Regards.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching using disk: basic
Object Caching 246/246 objects using disk: basic

Served from: stevenbenner.com @ 2012-01-15 23:43:08 -->
