<?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: JavaScript namespacing &#8211; an alternative to JavaScript inheritance</title>
	<atom:link href="http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/feed/" rel="self" type="application/rss+xml" />
	<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/</link>
	<description>Web development and Internet trends</description>
	<lastBuildDate>Sat, 20 Mar 2010 20:09:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-609758</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Wed, 11 Nov 2009 09:17:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-609758</guid>
		<description>Juan,

I&#039;d say it definitely depends on the situation. There are some cases when extending and just taking use of certain parts is more efficient and better for performance as well, while there are others where inheritance is the better way to go.</description>
		<content:encoded><![CDATA[<p>Juan,</p>
<p>I&#8217;d say it definitely depends on the situation. There are some cases when extending and just taking use of certain parts is more efficient and better for performance as well, while there are others where inheritance is the better way to go.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Juan Mendes</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-609694</link>
		<dc:creator>Juan Mendes</dc:creator>
		<pubDate>Tue, 10 Nov 2009 20:51:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-609694</guid>
		<description>I can&#039;t really agree with you on this one, though I appreciate the take. In this case, you are relying on all the instances to have a property defined brainCapacity, seems too coupled to me. 

The other problem I see is the fact the shared method is put into a random objext (the first on the list). Inheritance would create a logical place to put shared code. Here, you just have to know which of the objects has the shared method.</description>
		<content:encoded><![CDATA[<p>I can&#8217;t really agree with you on this one, though I appreciate the take. In this case, you are relying on all the instances to have a property defined brainCapacity, seems too coupled to me. </p>
<p>The other problem I see is the fact the shared method is put into a random objext (the first on the list). Inheritance would create a logical place to put shared code. Here, you just have to know which of the objects has the shared method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-597850</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Sun, 16 Aug 2009 22:16:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-597850</guid>
		<description>Anirudh Vyas,

Well, you could check for the existence, and if not&#039;s there, just create an empty container with curly braces (i.e. {}).

In your code example, though, you create closures that doesn&#039;t return anything. If you want to extend objects from other functions/files, you need to make them globally available.</description>
		<content:encoded><![CDATA[<p>Anirudh Vyas,</p>
<p>Well, you could check for the existence, and if not&#8217;s there, just create an empty container with curly braces (i.e. {}).</p>
<p>In your code example, though, you create closures that doesn&#8217;t return anything. If you want to extend objects from other functions/files, you need to make them globally available.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anirudh Vyas</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-597610</link>
		<dc:creator>Anirudh Vyas</dc:creator>
		<pubDate>Fri, 14 Aug 2009 15:20:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-597610</guid>
		<description>Hey,

So say I have, XNamespace.js which is like:

&lt;code&gt;
( function ( ) {
 
     X = {
          // stuff
  };

  X.LOG.info = function ( ) {

 };
}) ( );
&lt;/code&gt;

And then in another JS file, say YNamespace.js, I have got something like:

&lt;code&gt;
( function ( ) {
 
     X.Y = {
          // stuff
  };

  X.Y.somethingFunky = function ( ) {

 };
}) ( );
&lt;/code&gt;

How do I ensure that X is available for Y? So far, the solution that I have come up with is:

&lt;code&gt;
   if(typeof X === &#039;undefined&#039;) {
            document.write(&#039;&#039;);

 }
&lt;/code&gt;

Which i Think is funky, Any better solutions ? I am pretty new to this kinda stuff, so I cant think of any better ones out there ... Basically I wanna do something like dojo.require(&#039;X.Y.Z&#039;) and get the namespace. 

Suggestions?
Regards
Vyas, Anirudh</description>
		<content:encoded><![CDATA[<p>Hey,</p>
<p>So say I have, XNamespace.js which is like:</p>
<p><code><br />
( function ( ) {</p>
<p>     X = {<br />
          // stuff<br />
  };</p>
<p>  X.LOG.info = function ( ) {</p>
<p> };<br />
}) ( );<br />
</code></p>
<p>And then in another JS file, say YNamespace.js, I have got something like:</p>
<p><code><br />
( function ( ) {</p>
<p>     X.Y = {<br />
          // stuff<br />
  };</p>
<p>  X.Y.somethingFunky = function ( ) {</p>
<p> };<br />
}) ( );<br />
</code></p>
<p>How do I ensure that X is available for Y? So far, the solution that I have come up with is:</p>
<p><code><br />
   if(typeof X === 'undefined') {<br />
            document.write('');</p>
<p> }<br />
</code></p>
<p>Which i Think is funky, Any better solutions ? I am pretty new to this kinda stuff, so I cant think of any better ones out there &#8230; Basically I wanna do something like dojo.require(&#8216;X.Y.Z&#8217;) and get the namespace. </p>
<p>Suggestions?<br />
Regards<br />
Vyas, Anirudh</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A Knucklehead&#8217;s Guide to .NET &#187; Blog Archive &#187; Creating a JavaScript object dictionary</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-579206</link>
		<dc:creator>A Knucklehead&#8217;s Guide to .NET &#187; Blog Archive &#187; Creating a JavaScript object dictionary</dc:creator>
		<pubDate>Sat, 02 May 2009 20:25:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-579206</guid>
		<description>[...] 1 shows a popular way to namespace Javascript. In this case,if (&#160; if the variable rp is not yet defined, it is declared as a new empty [...]</description>
		<content:encoded><![CDATA[<p>[...] 1 shows a popular way to namespace Javascript. In this case,if (&#160; if the variable rp is not yet defined, it is declared as a new empty [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-510031</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Thu, 29 Jan 2009 16:53:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-510031</guid>
		<description>jQuery Howto,

Thanks for the link!</description>
		<content:encoded><![CDATA[<p>jQuery Howto,</p>
<p>Thanks for the link!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jQuery Howto</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-510014</link>
		<dc:creator>jQuery Howto</dc:creator>
		<pubDate>Thu, 29 Jan 2009 16:24:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-510014</guid>
		<description>Great article. Here is an article on how to use it with the jQuery object. In other words namespasing with the jQuery &lt;a href=&quot;http://jquery-howto.blogspot.com/2009/01/namespace-your-javascript-function-and.html&quot; rel=&quot;nofollow&quot;&gt;http://jquery-howto.blogspot.com/2009/01/namespace-your-javascript-function-and.html&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Great article. Here is an article on how to use it with the jQuery object. In other words namespasing with the jQuery <a href="http://jquery-howto.blogspot.com/2009/01/namespace-your-javascript-function-and.html" rel="nofollow">http://jquery-howto.blogspot.com/2009/01/namespace-your-javascript-function-and.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thank you for 2008 - Happy New Year! - Robert&#8217;s talk - Web development and Internet trends</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-492998</link>
		<dc:creator>Thank you for 2008 - Happy New Year! - Robert&#8217;s talk - Web development and Internet trends</dc:creator>
		<pubDate>Tue, 30 Dec 2008 21:40:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-492998</guid>
		<description>[...] JavaScript namespacing - an alternative to JavaScript inheritance [...]</description>
		<content:encoded><![CDATA[<p>[...] JavaScript namespacing &#8211; an alternative to JavaScript inheritance [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: erik&#8217;s weblog &#187; Blog Archive &#187; Instance private, class private, package and friends</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-474895</link>
		<dc:creator>erik&#8217;s weblog &#187; Blog Archive &#187; Instance private, class private, package and friends</dc:creator>
		<pubDate>Sat, 15 Nov 2008 07:47:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-474895</guid>
		<description>[...] post was inspired by a&#160;post that Robert Nyman wrote a while back. At the same time I was thinking about how to achieve private [...]</description>
		<content:encoded><![CDATA[<p>[...] post was inspired by a&nbsp;post that Robert Nyman wrote a while back. At the same time I was thinking about how to achieve private [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-472307</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Mon, 10 Nov 2008 19:29:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-472307</guid>
		<description>Stefan,

Thank you! :-)</description>
		<content:encoded><![CDATA[<p>Stefan,</p>
<p>Thank you! <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Van Reeth</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-471893</link>
		<dc:creator>Stefan Van Reeth</dc:creator>
		<pubDate>Sun, 09 Nov 2008 17:57:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-471893</guid>
		<description>Reading back (been away a while), I can&#039;t do anything but agree whith Roberts last answer to me. Different people - different backgrounds - different tastes. So we can go on and on and on. Just lovely :)</description>
		<content:encoded><![CDATA[<p>Reading back (been away a while), I can&#8217;t do anything but agree whith Roberts last answer to me. Different people &#8211; different backgrounds &#8211; different tastes. So we can go on and on and on. Just lovely <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-469440</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Mon, 03 Nov 2008 18:35:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-469440</guid>
		<description>Andy W,

Oh, absolutely, if you need to build on it, you would probably have some more generic object. It&#039;s just to exemplify reusage possibilities.</description>
		<content:encoded><![CDATA[<p>Andy W,</p>
<p>Oh, absolutely, if you need to build on it, you would probably have some more generic object. It&#8217;s just to exemplify reusage possibilities.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy W</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-469360</link>
		<dc:creator>Andy W</dc:creator>
		<pubDate>Mon, 03 Nov 2008 13:36:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-469360</guid>
		<description>In general, I&#039;d agree that object composition should be used in place of inheritance in many places. However I&#039;m a little uncomfortable with your Chris/Meg example. 

With this implementation, now we can&#039;t change the behaviour of Chris&#039; getCapacity method without breaking the functionality for Meg (suppose Chris developed low self esteem too?). One option might be to create a generic getCapacity method (perhaps on Griffins) which could be used (and augmented as needed) by each family member.</description>
		<content:encoded><![CDATA[<p>In general, I&#8217;d agree that object composition should be used in place of inheritance in many places. However I&#8217;m a little uncomfortable with your Chris/Meg example. </p>
<p>With this implementation, now we can&#8217;t change the behaviour of Chris&#8217; getCapacity method without breaking the functionality for Meg (suppose Chris developed low self esteem too?). One option might be to create a generic getCapacity method (perhaps on Griffins) which could be used (and augmented as needed) by each family member.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-468224</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Thu, 30 Oct 2008 16:41:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-468224</guid>
		<description>Stefan,

I do appreciate your feedback; hell, it&#039;s one of the reasons I allow comments, I don&#039;t want this web site to be just a one-way communication.

I want to understand different views and takes, and how people value different criteria. I don&#039;t have to agree with all input, but just respect that there&#039;s usually more than one way to do something.

Also, in the end I think it comes down a lot to personal experience: which kind of projects have one worked, with what kind of developers does one deliver code etc. So, it&#039;s all relative. :-)</description>
		<content:encoded><![CDATA[<p>Stefan,</p>
<p>I do appreciate your feedback; hell, it&#8217;s one of the reasons I allow comments, I don&#8217;t want this web site to be just a one-way communication.</p>
<p>I want to understand different views and takes, and how people value different criteria. I don&#8217;t have to agree with all input, but just respect that there&#8217;s usually more than one way to do something.</p>
<p>Also, in the end I think it comes down a lot to personal experience: which kind of projects have one worked, with what kind of developers does one deliver code etc. So, it&#8217;s all relative. <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Van Reeth</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-468194</link>
		<dc:creator>Stefan Van Reeth</dc:creator>
		<pubDate>Thu, 30 Oct 2008 12:58:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-468194</guid>
		<description>Well Robert, I really DO try to think along with your vision, but I feel we are far away from each other when it comes to programming tactics. Indeed I am a strong believer in classic OOP principles, just because they feel so natural to me. Because I do use several languages at a time I tend to stay away from techniques that are too language specific? Maybe, never gave it a thought really.

&lt;blockquote&gt;So, at times namespacing and inheritance complement each other just fine, but in other cases I really do think that namespacing alone can be sufficient.&lt;/blockquote&gt;Putting it that way I&#039;m almost tempted to agree with it. On the other hand I can&#039;t say I fully disagree either. In my experience I only find a use for pure namespacing when prototyping something new. After refactoring I always end up with inheritance chains. Considering we use largely different approaches, ending up with other solutions is no surprise.

Mind you, Robert, I do find your views very refreshing. Shooting holes in them is just a way to come to a better understanding. Untill the next shootout ;)</description>
		<content:encoded><![CDATA[<p>Well Robert, I really DO try to think along with your vision, but I feel we are far away from each other when it comes to programming tactics. Indeed I am a strong believer in classic OOP principles, just because they feel so natural to me. Because I do use several languages at a time I tend to stay away from techniques that are too language specific? Maybe, never gave it a thought really.</p>
<blockquote><p>So, at times namespacing and inheritance complement each other just fine, but in other cases I really do think that namespacing alone can be sufficient.</p></blockquote>
<p>Putting it that way I&#8217;m almost tempted to agree with it. On the other hand I can&#8217;t say I fully disagree either. In my experience I only find a use for pure namespacing when prototyping something new. After refactoring I always end up with inheritance chains. Considering we use largely different approaches, ending up with other solutions is no surprise.</p>
<p>Mind you, Robert, I do find your views very refreshing. Shooting holes in them is just a way to come to a better understanding. Untill the next shootout <img src='http://robertnyman.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-468166</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Thu, 30 Oct 2008 10:17:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-468166</guid>
		<description>Harmen,

Thanks!

Stefan,

To begin with, no matter how you choose to work with inheritance, I&#039;d say that namespacing is always a good idea and a great complement to other code!

What I was also arguing for here is that OOP pricinples aren&#039;t &lt;em&gt;always&lt;/em&gt; the best solution, especially for certain web scenarios. When it comes to extensive reusage of code, inheritance can naturally be a good thing, but from what I often see, it is way overused and complicaced in cases where it doesn&#039;t have to be.

So, at times namespacing and inheritance complement each other just fine, but in ohter cases I really do think that namespacing alone can be sufficient.</description>
		<content:encoded><![CDATA[<p>Harmen,</p>
<p>Thanks!</p>
<p>Stefan,</p>
<p>To begin with, no matter how you choose to work with inheritance, I&#8217;d say that namespacing is always a good idea and a great complement to other code!</p>
<p>What I was also arguing for here is that OOP pricinples aren&#8217;t <em>always</em> the best solution, especially for certain web scenarios. When it comes to extensive reusage of code, inheritance can naturally be a good thing, but from what I often see, it is way overused and complicaced in cases where it doesn&#8217;t have to be.</p>
<p>So, at times namespacing and inheritance complement each other just fine, but in ohter cases I really do think that namespacing alone can be sufficient.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefan Van Reeth</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-468016</link>
		<dc:creator>Stefan Van Reeth</dc:creator>
		<pubDate>Wed, 29 Oct 2008 18:22:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-468016</guid>
		<description>After reading both Roberts and Harmens posts, one remark (agreeing on everything is sooo dull :) ): Robert approaches inheritance and namespacing as alternatives to each other, while I see the namespacing as an additional technique alongside inheritance. I feel Harmen also leans more towards that thought. At least he uses his namespaces pretty much the way I do, namely as the container for all code belonging to that particular project.
I understand that Roberts example above is just that, an example. However, it would be way more logical to put the getCapacity function into a Person object and have Chris and Meg inherit from that. That structuring still allows both to do something extra with the result and makes both independent from each other. True, they now depend both on Person, but logically that makes more sense. Basic OOP stuff in fact.
One example why the original example ain&#039;t such a good practice: say you need the Meg object in another project. In Roberts example you&#039;ll need to study the code to discover why the Chris object needs to be ported too, while in an inheritance approach it would be far easier to spot that a Person object should come over too. What&#039;s the difference then? In both scenarios we need to port two objects just to use Meg (hmm, sounds weird...). True, but what if we port say 50 person-like objects? Are we gonna study them all to discover what specific persons they depend on, or do we just import a generic Person and be gone with it? I know what I prefer...
All this to say that in no way namespacing and inheritance should exclude each other. On the contrary, using both techniques leads to more logical, easier to maintain and more portable code. Why throw away decades of good practices? Last time I checked, OOP isn&#039;t restricted to classical languages. Serious JavaScript projects benefit also from the hard-learned OOP best practices.
The true beaty of JavaScript &#039;namespacing&#039; is that all newly introduced code is found under one global, avoiding the &#039;evil globals&#039; problem gracefully. The second advantage is when a project demands externally produced modules. If everyone would namespace their code, function name clashes and the like would be a thing of the past.
And those two reasons are enough to ALWAYS namespace things.</description>
		<content:encoded><![CDATA[<p>After reading both Roberts and Harmens posts, one remark (agreeing on everything is sooo dull <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ): Robert approaches inheritance and namespacing as alternatives to each other, while I see the namespacing as an additional technique alongside inheritance. I feel Harmen also leans more towards that thought. At least he uses his namespaces pretty much the way I do, namely as the container for all code belonging to that particular project.<br />
I understand that Roberts example above is just that, an example. However, it would be way more logical to put the getCapacity function into a Person object and have Chris and Meg inherit from that. That structuring still allows both to do something extra with the result and makes both independent from each other. True, they now depend both on Person, but logically that makes more sense. Basic OOP stuff in fact.<br />
One example why the original example ain&#8217;t such a good practice: say you need the Meg object in another project. In Roberts example you&#8217;ll need to study the code to discover why the Chris object needs to be ported too, while in an inheritance approach it would be far easier to spot that a Person object should come over too. What&#8217;s the difference then? In both scenarios we need to port two objects just to use Meg (hmm, sounds weird&#8230;). True, but what if we port say 50 person-like objects? Are we gonna study them all to discover what specific persons they depend on, or do we just import a generic Person and be gone with it? I know what I prefer&#8230;<br />
All this to say that in no way namespacing and inheritance should exclude each other. On the contrary, using both techniques leads to more logical, easier to maintain and more portable code. Why throw away decades of good practices? Last time I checked, OOP isn&#8217;t restricted to classical languages. Serious JavaScript projects benefit also from the hard-learned OOP best practices.<br />
The true beaty of JavaScript &#8216;namespacing&#8217; is that all newly introduced code is found under one global, avoiding the &#8216;evil globals&#8217; problem gracefully. The second advantage is when a project demands externally produced modules. If everyone would namespace their code, function name clashes and the like would be a thing of the past.<br />
And those two reasons are enough to ALWAYS namespace things.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Harmen Janssen</title>
		<link>http://robertnyman.com/2008/10/29/javascript-namespacing-an-alternative-to-javascript-inheritance/#comment-468009</link>
		<dc:creator>Harmen Janssen</dc:creator>
		<pubDate>Wed, 29 Oct 2008 16:36:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/?p=930#comment-468009</guid>
		<description>I think this is a great approach and it&#039;s a good thing many people write about it. In fact, &lt;a href=&quot;http://www.whatstyle.net/articles/53/making_the_most_of_javascript_namespacing&quot; rel=&quot;nofollow&quot;&gt;you inspired me to write about it&lt;/a&gt; :)</description>
		<content:encoded><![CDATA[<p>I think this is a great approach and it&#8217;s a good thing many people write about it. In fact, <a href="http://www.whatstyle.net/articles/53/making_the_most_of_javascript_namespacing" rel="nofollow">you inspired me to write about it</a> <img src='http://robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
