<?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: How global is your JavaScript?</title>
	<atom:link href="http://ajaxian.com/archives/how-global-is-your-javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/how-global-is-your-javascript</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:55:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: jhuni</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-275850</link>
		<dc:creator>jhuni</dc:creator>
		<pubDate>Thu, 08 Oct 2009 07:42:24 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-275850</guid>
		<description>The interesting thing here is it says MochiKit has 243 globals, which isn&#039;t the whole story because it actually uses an export system so you don&#039;t have to have anything except for MochiKit in the global namespace at any one time.

Besides that you can code your entire application with those symbols exported, and then restore them to their previous values after your library is compiled.</description>
		<content:encoded><![CDATA[<p>The interesting thing here is it says MochiKit has 243 globals, which isn&#8217;t the whole story because it actually uses an export system so you don&#8217;t have to have anything except for MochiKit in the global namespace at any one time.</p>
<p>Besides that you can code your entire application with those symbols exported, and then restore them to their previous values after your library is compiled.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PeterMichaux</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270682</link>
		<dc:creator>PeterMichaux</dc:creator>
		<pubDate>Thu, 22 Jan 2009 19:38:21 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270682</guid>
		<description>mschwartz, Where I work, we namespace CSS by using a prefix like &quot;CO_&quot; so we would have &quot;CO_wrapper&quot;, &quot;CO_header&quot;, etc.</description>
		<content:encoded><![CDATA[<p>mschwartz, Where I work, we namespace CSS by using a prefix like &#8220;CO_&#8221; so we would have &#8220;CO_wrapper&#8221;, &#8220;CO_header&#8221;, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nosredna</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270660</link>
		<dc:creator>Nosredna</dc:creator>
		<pubDate>Wed, 21 Jan 2009 21:12:56 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270660</guid>
		<description>Jordan1,

Have you actually tested that? A global is still part of window. has anyone done a test to see how slow it is to access a variable inside an object? Possibly, it&#039;s even faster, since the list of things to check would be smaller. If everyone polluted, the number of objects under &quot;window&quot; could be huge and slow everything down. All depends on the implementation, and could easily be different on different browsers.</description>
		<content:encoded><![CDATA[<p>Jordan1,</p>
<p>Have you actually tested that? A global is still part of window. has anyone done a test to see how slow it is to access a variable inside an object? Possibly, it&#8217;s even faster, since the list of things to check would be smaller. If everyone polluted, the number of objects under &#8220;window&#8221; could be huge and slow everything down. All depends on the implementation, and could easily be different on different browsers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mschwartz</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270659</link>
		<dc:creator>mschwartz</dc:creator>
		<pubDate>Wed, 21 Jan 2009 21:06:54 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270659</guid>
		<description>Note in the above:
example:
&lt;div class=&quot;wrap&quot;&gt;...&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p>Note in the above:<br />
example:<br />
&lt;div class=&#8221;wrap&#8221;&gt;&#8230;&lt;/div&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mschwartz</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270658</link>
		<dc:creator>mschwartz</dc:creator>
		<pubDate>Wed, 21 Jan 2009 21:05:59 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270658</guid>
		<description>Nobody seems to talk about collisions in the CSS namespace.  CSS basically only has one global namespace and it&#039;s really easy to create selectors that collide with or clobber some 3rd party component you&#039;ve decided to use.

Example:
...

Designers like to use the name &quot;wrap&quot; for some reason, and it wouldn&#039;t surprise me in the least if toolkits used the same name/id in autogenerated DOM elements.</description>
		<content:encoded><![CDATA[<p>Nobody seems to talk about collisions in the CSS namespace.  CSS basically only has one global namespace and it&#8217;s really easy to create selectors that collide with or clobber some 3rd party component you&#8217;ve decided to use.</p>
<p>Example:<br />
&#8230;</p>
<p>Designers like to use the name &#8220;wrap&#8221; for some reason, and it wouldn&#8217;t surprise me in the least if toolkits used the same name/id in autogenerated DOM elements.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mankz</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270655</link>
		<dc:creator>mankz</dc:creator>
		<pubDate>Wed, 21 Jan 2009 20:36:20 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270655</guid>
		<description>I updated the tool with a conflict matrix between the frameworks. 

Grrrrreat enjoy!</description>
		<content:encoded><![CDATA[<p>I updated the tool with a conflict matrix between the frameworks. </p>
<p>Grrrrreat enjoy!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jordan1</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270644</link>
		<dc:creator>Jordan1</dc:creator>
		<pubDate>Wed, 21 Jan 2009 09:52:40 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270644</guid>
		<description>Global pollution should be a carefully balanced trade-off. Too much or too little of something is not good. Sensible amounts of global pollution can actually increase performance.
&lt;b&gt; &lt;/b&gt;
Think about the global scope as computer RAM, and namespaces as virtual memory (that exists on the hard disk).
&lt;blockquote&gt;&lt;/blockquote&gt;
If a function is called repeatedly, putting it in RAM (global scope) makes it quickly accessible. Hiding it behind a namespace makes it take longer to access (to resolve the namespace links). If a function is seldom called, putting it in virtual memory frees the RAM and allows other existing functions in RAM to be called faster.
&lt;blockquote&gt;&lt;/blockquote&gt;
Programmers should exercise discretion in choosing where to put their functions.</description>
		<content:encoded><![CDATA[<p>Global pollution should be a carefully balanced trade-off. Too much or too little of something is not good. Sensible amounts of global pollution can actually increase performance.<br />
<b> </b><br />
Think about the global scope as computer RAM, and namespaces as virtual memory (that exists on the hard disk).</p>
<blockquote></blockquote>
<p>If a function is called repeatedly, putting it in RAM (global scope) makes it quickly accessible. Hiding it behind a namespace makes it take longer to access (to resolve the namespace links). If a function is seldom called, putting it in virtual memory frees the RAM and allows other existing functions in RAM to be called faster.</p>
<blockquote></blockquote>
<p>Programmers should exercise discretion in choosing where to put their functions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PeterMichaux</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270638</link>
		<dc:creator>PeterMichaux</dc:creator>
		<pubDate>Wed, 21 Jan 2009 06:28:36 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270638</guid>
		<description>&quot;We like to talk about how evil global variables are, but I wonder if we take this a touch too seriously sometimes.&quot;

.

I think is worth taking seriously because once a reasonable solution to the problem is taken, the problem is over and the chance of a namespace collision is virtually naught.

.

With regard to namespacing, I think there is no difference between creating a &quot;global variable&quot; and &quot;augmenting&quot;. When creating a global variables, the program is adding a property to the &quot;window&quot; object. When augmenting the program is adding an object to &quot;String.prototype&quot;, for example. What is the difference? Both &quot;window&quot; and &quot;String.prototype&quot; are public objects to which the program is allowed to add properties. Both ways are really augmenting.

.

What is potentially bad is when a program adds &quot;String.prototype.trim&quot; which could easily collide with another library. Instead, if the program added &quot;String.prototype.com_ajaxian_trim&quot; then the chance of a namespace collision is slim. The important part is something reasonably unique is in the property name. Sensibly named properties when augmenting gives good collision protection.

.

Placing all of a library in one global object which is reasonably unique provides namespace protection but gives up other features of the language that can be gained through augmenting.

.

The $ character in property names certainly is not &quot;reasonably unique&quot;. Even &quot;MS_&quot; or &quot;BillyG_&quot; would have been much better protection and are not so long. With a good editor even a long string is only a couple keystrokes away.</description>
		<content:encoded><![CDATA[<p>&#8220;We like to talk about how evil global variables are, but I wonder if we take this a touch too seriously sometimes.&#8221;</p>
<p>.</p>
<p>I think is worth taking seriously because once a reasonable solution to the problem is taken, the problem is over and the chance of a namespace collision is virtually naught.</p>
<p>.</p>
<p>With regard to namespacing, I think there is no difference between creating a &#8220;global variable&#8221; and &#8220;augmenting&#8221;. When creating a global variables, the program is adding a property to the &#8220;window&#8221; object. When augmenting the program is adding an object to &#8220;String.prototype&#8221;, for example. What is the difference? Both &#8220;window&#8221; and &#8220;String.prototype&#8221; are public objects to which the program is allowed to add properties. Both ways are really augmenting.</p>
<p>.</p>
<p>What is potentially bad is when a program adds &#8220;String.prototype.trim&#8221; which could easily collide with another library. Instead, if the program added &#8220;String.prototype.com_ajaxian_trim&#8221; then the chance of a namespace collision is slim. The important part is something reasonably unique is in the property name. Sensibly named properties when augmenting gives good collision protection.</p>
<p>.</p>
<p>Placing all of a library in one global object which is reasonably unique provides namespace protection but gives up other features of the language that can be gained through augmenting.</p>
<p>.</p>
<p>The $ character in property names certainly is not &#8220;reasonably unique&#8221;. Even &#8220;MS_&#8221; or &#8220;BillyG_&#8221; would have been much better protection and are not so long. With a good editor even a long string is only a couple keystrokes away.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ibolmo</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270636</link>
		<dc:creator>ibolmo</dc:creator>
		<pubDate>Wed, 21 Jan 2009 04:30:47 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270636</guid>
		<description>Eh.. not as much as you&#039;d think. But it is a form of contamination, so no argument here. It&#039;s the good kind of contamination though :).</description>
		<content:encoded><![CDATA[<p>Eh.. not as much as you&#8217;d think. But it is a form of contamination, so no argument here. It&#8217;s the good kind of contamination though :).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: scoult01</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270635</link>
		<dc:creator>scoult01</dc:creator>
		<pubDate>Wed, 21 Jan 2009 04:29:49 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270635</guid>
		<description>I for one am not surprised to see the .NET Ajax library leading the pack. It is coded SO badly (unfortunately the &#039;lead&#039; developer at work refuses to use anything else) and is a pain in the ass to use.
__doPostBack() and Microsoft&#039;s single form element on a page philosophy needs to die a slow and painful death. As do the developers that advocate it.

No surprises to see jQuery, Dojo, Ext up there with low usage of global variables. Makes a difference when the coders know what they are doing.</description>
		<content:encoded><![CDATA[<p>I for one am not surprised to see the .NET Ajax library leading the pack. It is coded SO badly (unfortunately the &#8216;lead&#8217; developer at work refuses to use anything else) and is a pain in the ass to use.<br />
__doPostBack() and Microsoft&#8217;s single form element on a page philosophy needs to die a slow and painful death. As do the developers that advocate it.</p>
<p>No surprises to see jQuery, Dojo, Ext up there with low usage of global variables. Makes a difference when the coders know what they are doing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nosredna</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270624</link>
		<dc:creator>Nosredna</dc:creator>
		<pubDate>Tue, 20 Jan 2009 19:48:49 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270624</guid>
		<description>&quot;Augmented&quot; makes me at least as nervous as &quot;Globals.&quot; A big old &quot;boo&quot; to MooTools, Prototype, and Microsoft.</description>
		<content:encoded><![CDATA[<p>&#8220;Augmented&#8221; makes me at least as nervous as &#8220;Globals.&#8221; A big old &#8220;boo&#8221; to MooTools, Prototype, and Microsoft.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ibolmo</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270622</link>
		<dc:creator>ibolmo</dc:creator>
		<pubDate>Tue, 20 Jan 2009 18:58:02 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270622</guid>
		<description>Nevermind, just noticed the &quot;augment..&quot;. ;)</description>
		<content:encoded><![CDATA[<p>Nevermind, just noticed the &#8220;augment..&#8221;. ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ibolmo</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270621</link>
		<dc:creator>ibolmo</dc:creator>
		<pubDate>Tue, 20 Jan 2009 18:54:38 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270621</guid>
		<description>I thought that this would show only window[...], but it seems it even returns Native methods that are added to prototypes, or generics Array.xxx.

In my opinion, that is not indicative of global space contamination.</description>
		<content:encoded><![CDATA[<p>I thought that this would show only window[...], but it seems it even returns Native methods that are added to prototypes, or generics Array.xxx.</p>
<p>In my opinion, that is not indicative of global space contamination.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cromwellian</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270618</link>
		<dc:creator>cromwellian</dc:creator>
		<pubDate>Tue, 20 Jan 2009 17:56:39 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270618</guid>
		<description>The projects may be doing fine, but global pollution represents a growing environmental problem. If you use only one monolithic library, or a small number of them, it probably won&#039;t be a problem, but as the Javascript code base grows, the chances of a nasty surprise bug that ordinary non-JS ninjas will have to deal with increases.

If Javascript advocates really want it to become a serious language, even on the server, and compete directly with Ruby, Python, Java, et al, they&#039;re going to have to get more rigorous and serious about packaging/namespacing. Javascript desperately needs a standard &quot;non-roll-your-own&quot; package/module system.</description>
		<content:encoded><![CDATA[<p>The projects may be doing fine, but global pollution represents a growing environmental problem. If you use only one monolithic library, or a small number of them, it probably won&#8217;t be a problem, but as the Javascript code base grows, the chances of a nasty surprise bug that ordinary non-JS ninjas will have to deal with increases.</p>
<p>If Javascript advocates really want it to become a serious language, even on the server, and compete directly with Ruby, Python, Java, et al, they&#8217;re going to have to get more rigorous and serious about packaging/namespacing. Javascript desperately needs a standard &#8220;non-roll-your-own&#8221; package/module system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hymanroth</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270617</link>
		<dc:creator>hymanroth</dc:creator>
		<pubDate>Tue, 20 Jan 2009 17:20:18 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270617</guid>
		<description>LM Framework [http://lmframework.com] also uses a single global object.

This is by far the cleanest approach, and has the added advantage of allowing the entire system state to be xmlHTTP&#039;d back to the server for debugging.</description>
		<content:encoded><![CDATA[<p>LM Framework [http://lmframework.com] also uses a single global object.</p>
<p>This is by far the cleanest approach, and has the added advantage of allowing the entire system state to be xmlHTTP&#8217;d back to the server for debugging.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RyanMorr</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270615</link>
		<dc:creator>RyanMorr</dc:creator>
		<pubDate>Tue, 20 Jan 2009 16:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270615</guid>
		<description>I agree, namespacing is the way to go, besides I hate those reallyLongMethodAndPropertyNames()</description>
		<content:encoded><![CDATA[<p>I agree, namespacing is the way to go, besides I hate those reallyLongMethodAndPropertyNames()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nosredna</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270612</link>
		<dc:creator>Nosredna</dc:creator>
		<pubDate>Tue, 20 Jan 2009 16:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270612</guid>
		<description>I put everything into a single object. It&#039;s easy to do. I can&#039;t think of a good reason not to.</description>
		<content:encoded><![CDATA[<p>I put everything into a single object. It&#8217;s easy to do. I can&#8217;t think of a good reason not to.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mankz</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270611</link>
		<dc:creator>mankz</dc:creator>
		<pubDate>Tue, 20 Jan 2009 15:18:46 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270611</guid>
		<description>@sekostar: Using Chrome/Safari? Try using FF3, data should be correct. I don&#039;t know why the results are different in your browser... Any idea?</description>
		<content:encoded><![CDATA[<p>@sekostar: Using Chrome/Safari? Try using FF3, data should be correct. I don&#8217;t know why the results are different in your browser&#8230; Any idea?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jani</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270609</link>
		<dc:creator>Jani</dc:creator>
		<pubDate>Tue, 20 Jan 2009 14:15:26 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270609</guid>
		<description>Rather than just concentrating on globals, you should consider the augments column too.

The more augments a library does, the less likely it&#039;s to play nice with other libraries!</description>
		<content:encoded><![CDATA[<p>Rather than just concentrating on globals, you should consider the augments column too.</p>
<p>The more augments a library does, the less likely it&#8217;s to play nice with other libraries!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sekostar</title>
		<link>http://ajaxian.com/archives/how-global-is-your-javascript/comment-page-1#comment-270608</link>
		<dc:creator>sekostar</dc:creator>
		<pubDate>Tue, 20 Jan 2009 13:55:23 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=5727#comment-270608</guid>
		<description>Nice work but I just discovered that &quot;crypto&quot; and &quot;event&quot; objects are common for each item. So they shouldn&#039;t be counted as globals.</description>
		<content:encoded><![CDATA[<p>Nice work but I just discovered that &#8220;crypto&#8221; and &#8220;event&#8221; objects are common for each item. So they shouldn&#8217;t be counted as globals.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

