<?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: Making sure you get new instances in JavaScript</title>
	<atom:link href="http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-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: Frank Thuerigen</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259828</link>
		<dc:creator>Frank Thuerigen</dc:creator>
		<pubDate>Sat, 08 Dec 2007 13:43:03 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259828</guid>
		<description>Whenever I read one of Johns articles it provides a new insight and some coding pattern learning. Maybe not for me all the times but for many at least. What John really shows in his articles is how versatile JS is - and he is really good in quenching the most out of this language.
So the real value of this is not whether you should use it or not, but what you can learn from it.</description>
		<content:encoded><![CDATA[<p>Whenever I read one of Johns articles it provides a new insight and some coding pattern learning. Maybe not for me all the times but for many at least. What John really shows in his articles is how versatile JS is &#8211; and he is really good in quenching the most out of this language.<br />
So the real value of this is not whether you should use it or not, but what you can learn from it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: elmuchacho</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259827</link>
		<dc:creator>elmuchacho</dc:creator>
		<pubDate>Sat, 08 Dec 2007 11:20:29 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259827</guid>
		<description>@Rey Bango 

I think you should have read my small comment as well I&#039;m not insulting John but instead complimented him on the trick. The reference to developer stupidity was not directed at John but at developer in general even me when I make mistake like forgetting the &#039;new&#039; I call myself stupid.

My comment did sound a bit firing but at the concept for a simple reason that I don&#039;t think it will help using it as a generic method to declare your classes in this manner as the performance result will be un-acceptable in a production environment. But hey that&#039;s just me let&#039;s ask John if he think that increasing by approx 60% the instance creation time is acceptable?</description>
		<content:encoded><![CDATA[<p>@Rey Bango </p>
<p>I think you should have read my small comment as well I&#8217;m not insulting John but instead complimented him on the trick. The reference to developer stupidity was not directed at John but at developer in general even me when I make mistake like forgetting the &#8216;new&#8217; I call myself stupid.</p>
<p>My comment did sound a bit firing but at the concept for a simple reason that I don&#8217;t think it will help using it as a generic method to declare your classes in this manner as the performance result will be un-acceptable in a production environment. But hey that&#8217;s just me let&#8217;s ask John if he think that increasing by approx 60% the instance creation time is acceptable?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeria</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259823</link>
		<dc:creator>Jeria</dc:creator>
		<pubDate>Sat, 08 Dec 2007 10:09:44 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259823</guid>
		<description>@Phillips &quot;new&quot; is code bloat? What is next, a function to replace the even more bloated &quot;alert&quot;?</description>
		<content:encoded><![CDATA[<p>@Phillips &#8220;new&#8221; is code bloat? What is next, a function to replace the even more bloated &#8220;alert&#8221;?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Phillips</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259812</link>
		<dc:creator>Chris Phillips</dc:creator>
		<pubDate>Fri, 07 Dec 2007 22:15:13 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259812</guid>
		<description>Actually if your creating 100+ objects across multiple files then doing it without &quot;new&quot; can cut down on code bloat.</description>
		<content:encoded><![CDATA[<p>Actually if your creating 100+ objects across multiple files then doing it without &#8220;new&#8221; can cut down on code bloat.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeria</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259810</link>
		<dc:creator>Jeria</dc:creator>
		<pubDate>Fri, 07 Dec 2007 19:54:49 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259810</guid>
		<description>So... All this extra code to make up for a rookie developer forgetting to use the new keyword? Only extra code I would for that would be to throw an Error telling the programmer to re-read the JavaScript basics.

:)</description>
		<content:encoded><![CDATA[<p>So&#8230; All this extra code to make up for a rookie developer forgetting to use the new keyword? Only extra code I would for that would be to throw an Error telling the programmer to re-read the JavaScript basics.</p>
<p>:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samori Gorse</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259808</link>
		<dc:creator>Samori Gorse</dc:creator>
		<pubDate>Fri, 07 Dec 2007 19:09:07 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259808</guid>
		<description>@Rey Bango : I totally understand you&#039;re point of view, but I don&#039;t think correcting a coding error at the fly would be any help.

I mean, when I write  :

if(myvalue=null)

instead of :

if(myvalue==null)

Nothing is telling me I&#039;m doing something wrong, but my conditionnal is always true while this might not be the behaviour expected. 
That&#039;s why, I would write :

if(null==myvalue)

And if I&#039;m forgotting a equal sign, I&#039;ll get an error, that&#039;s what errors are for, to be reported. When you do mistakes and learn from them, you&#039;re actually improving you skills.

At least, that&#039;s my opinion.

PS : Sorry for mistakes, I&#039;m French, but I&#039;m learning ;-)</description>
		<content:encoded><![CDATA[<p>@Rey Bango : I totally understand you&#8217;re point of view, but I don&#8217;t think correcting a coding error at the fly would be any help.</p>
<p>I mean, when I write  :</p>
<p>if(myvalue=null)</p>
<p>instead of :</p>
<p>if(myvalue==null)</p>
<p>Nothing is telling me I&#8217;m doing something wrong, but my conditionnal is always true while this might not be the behaviour expected.<br />
That&#8217;s why, I would write :</p>
<p>if(null==myvalue)</p>
<p>And if I&#8217;m forgotting a equal sign, I&#8217;ll get an error, that&#8217;s what errors are for, to be reported. When you do mistakes and learn from them, you&#8217;re actually improving you skills.</p>
<p>At least, that&#8217;s my opinion.</p>
<p>PS : Sorry for mistakes, I&#8217;m French, but I&#8217;m learning ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Kant</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259806</link>
		<dc:creator>Andy Kant</dc:creator>
		<pubDate>Fri, 07 Dec 2007 17:46:34 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259806</guid>
		<description>While this is a pretty elegant solution, it promotes bad practice. I agree with Samori that this would be better caught in the debugging phase rather than to provide an crutch that would lead you into making the same mistake over and over. Besides, the best way to get better at a language is to make mistakes and learn from them.</description>
		<content:encoded><![CDATA[<p>While this is a pretty elegant solution, it promotes bad practice. I agree with Samori that this would be better caught in the debugging phase rather than to provide an crutch that would lead you into making the same mistake over and over. Besides, the best way to get better at a language is to make mistakes and learn from them.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259804</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Fri, 07 Dec 2007 17:22:46 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259804</guid>
		<description>I agree with something in almost all the comments.

First, if &#039;new&#039; fixes things then &#039;new&#039; is the pain free way and I&#039;m afraid John&#039;s suggestion is not practical.

That said, John&#039;s code seems to also be a nifty poc at least.  I think it&#039;s pretty damn cool and appreciate getting to see/learn from it.  Thx John!  I agree wholeheartedly with Rey in having a big fat ? regarding the bad attitude of some in the comments.</description>
		<content:encoded><![CDATA[<p>I agree with something in almost all the comments.</p>
<p>First, if &#8216;new&#8217; fixes things then &#8216;new&#8217; is the pain free way and I&#8217;m afraid John&#8217;s suggestion is not practical.</p>
<p>That said, John&#8217;s code seems to also be a nifty poc at least.  I think it&#8217;s pretty damn cool and appreciate getting to see/learn from it.  Thx John!  I agree wholeheartedly with Rey in having a big fat ? regarding the bad attitude of some in the comments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rey Bango</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259800</link>
		<dc:creator>Rey Bango</dc:creator>
		<pubDate>Fri, 07 Dec 2007 17:07:12 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259800</guid>
		<description>@Samori: From what I&#039;m gathering from reading the post and knowing John myself, it looks like he&#039;s trying to make it easier for new developers to avoid making a coding error. That&#039;s what I&#039;m seeing.  Apart from that, it doesn&#039;t really matter to me if developers don&#039;t find it useful or not. I respect everyone&#039;s opinion and if you don&#039;t think it&#039;s to your benefit, I totally understand. I&#039;m just a bit astonished by some of the vitriol comments that I&#039;ve seen of late. Its as if some people have lost their ability to discuss topics in a calm, collected manner.</description>
		<content:encoded><![CDATA[<p>@Samori: From what I&#8217;m gathering from reading the post and knowing John myself, it looks like he&#8217;s trying to make it easier for new developers to avoid making a coding error. That&#8217;s what I&#8217;m seeing.  Apart from that, it doesn&#8217;t really matter to me if developers don&#8217;t find it useful or not. I respect everyone&#8217;s opinion and if you don&#8217;t think it&#8217;s to your benefit, I totally understand. I&#8217;m just a bit astonished by some of the vitriol comments that I&#8217;ve seen of late. Its as if some people have lost their ability to discuss topics in a calm, collected manner.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samori Gorse</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259799</link>
		<dc:creator>Samori Gorse</dc:creator>
		<pubDate>Fri, 07 Dec 2007 16:41:27 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259799</guid>
		<description>@Rey Bango, 

He&#039;s not fixing anything, but there&#039;s still no point in doing such a thing. Maybe I&#039;m missing something, but I can&#039;t see how 3 letters can ease any pain.</description>
		<content:encoded><![CDATA[<p>@Rey Bango, </p>
<p>He&#8217;s not fixing anything, but there&#8217;s still no point in doing such a thing. Maybe I&#8217;m missing something, but I can&#8217;t see how 3 letters can ease any pain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rey Bango</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259798</link>
		<dc:creator>Rey Bango</dc:creator>
		<pubDate>Fri, 07 Dec 2007 16:31:22 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259798</guid>
		<description>@Laurent: I don&#039;t see John as fixing anything but simply trying to build a method of easing some instantiation pains. If you read *his* full post and the comments, it looks like Sebastian Werner (QooxDoo) and Brendan Eich (creator of JS) seem to like his article. 

Also, why would you attack John personally? Has he done anything to you for you to lower yourself to name-calling?</description>
		<content:encoded><![CDATA[<p>@Laurent: I don&#8217;t see John as fixing anything but simply trying to build a method of easing some instantiation pains. If you read *his* full post and the comments, it looks like Sebastian Werner (QooxDoo) and Brendan Eich (creator of JS) seem to like his article. </p>
<p>Also, why would you attack John personally? Has he done anything to you for you to lower yourself to name-calling?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Laurent V.</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259795</link>
		<dc:creator>Laurent V.</dc:creator>
		<pubDate>Fri, 07 Dec 2007 14:56:28 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259795</guid>
		<description>As always crappy Resig javascript &quot;fixing&quot; where there is no issue.

You want to have var x = new User() ? well, don&#039;t forget the &quot;new&quot;, that&#039;s all, no need for a crappy makeClass()</description>
		<content:encoded><![CDATA[<p>As always crappy Resig javascript &#8220;fixing&#8221; where there is no issue.</p>
<p>You want to have var x = new User() ? well, don&#8217;t forget the &#8220;new&#8221;, that&#8217;s all, no need for a crappy makeClass()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: elmuchacho</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259793</link>
		<dc:creator>elmuchacho</dc:creator>
		<pubDate>Fri, 07 Dec 2007 14:13:58 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259793</guid>
		<description>The performance issue is also considerable almost twice the amount of time to create the instance of a User object. 

I share &#039;Samori&#039; point on if the user is not doing what he should why should you clutter your code to make for there stupidity. However that said it is indeed a pretty nice trick.

Really simple benchmark example page below.
John Way:
http://lm.elmuchacho.com/library/tests/makeClass_john_resig/makeClass.htm
Native Way:
http://lm.elmuchacho.com/library/tests/makeClass_john_resig/native.htm

The result speak of itself.</description>
		<content:encoded><![CDATA[<p>The performance issue is also considerable almost twice the amount of time to create the instance of a User object. </p>
<p>I share &#8216;Samori&#8217; point on if the user is not doing what he should why should you clutter your code to make for there stupidity. However that said it is indeed a pretty nice trick.</p>
<p>Really simple benchmark example page below.<br />
John Way:<br />
<a href="http://lm.elmuchacho.com/library/tests/makeClass_john_resig/makeClass.htm" rel="nofollow">http://lm.elmuchacho.com/library/tests/makeClass_john_resig/makeClass.htm</a><br />
Native Way:<br />
<a href="http://lm.elmuchacho.com/library/tests/makeClass_john_resig/native.htm" rel="nofollow">http://lm.elmuchacho.com/library/tests/makeClass_john_resig/native.htm</a></p>
<p>The result speak of itself.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Krzysztof</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259792</link>
		<dc:creator>Krzysztof</dc:creator>
		<pubDate>Fri, 07 Dec 2007 13:17:19 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259792</guid>
		<description>Putting such intelligence into fighting with obvious typing-like errors is some kind of misunderstanding. I&#039;d rather wouldn&#039;t like to work with class system which crucial part trying to repair my mistakes and convince me what I should have in mind instead.</description>
		<content:encoded><![CDATA[<p>Putting such intelligence into fighting with obvious typing-like errors is some kind of misunderstanding. I&#8217;d rather wouldn&#8217;t like to work with class system which crucial part trying to repair my mistakes and convince me what I should have in mind instead.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Site Smart</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259791</link>
		<dc:creator>Site Smart</dc:creator>
		<pubDate>Fri, 07 Dec 2007 13:05:39 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259791</guid>
		<description>sorry I meant to say it shouldn&#039;t be covered up</description>
		<content:encoded><![CDATA[<p>sorry I meant to say it shouldn&#8217;t be covered up</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Site Smart</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259790</link>
		<dc:creator>Site Smart</dc:creator>
		<pubDate>Fri, 07 Dec 2007 13:05:07 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259790</guid>
		<description>@samori

That was exactly what I was thinking when reading this. It is a programmer&#039;s error it should be covered up. This creates a debugging mess.</description>
		<content:encoded><![CDATA[<p>@samori</p>
<p>That was exactly what I was thinking when reading this. It is a programmer&#8217;s error it should be covered up. This creates a debugging mess.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dcrec1</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259788</link>
		<dc:creator>dcrec1</dc:creator>
		<pubDate>Fri, 07 Dec 2007 11:48:58 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259788</guid>
		<description>What if I don&#039;t want to get a new User?

This misleads to horrible code design and probably future refactoring problems. 

If i write a program to print &quot;Helo World&quot;, it should print &quot;Helo World&quot;, not &quot;Hello World&quot;, just as an example.</description>
		<content:encoded><![CDATA[<p>What if I don&#8217;t want to get a new User?</p>
<p>This misleads to horrible code design and probably future refactoring problems. </p>
<p>If i write a program to print &#8220;Helo World&#8221;, it should print &#8220;Helo World&#8221;, not &#8220;Hello World&#8221;, just as an example.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samori Gorse</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259786</link>
		<dc:creator>Samori Gorse</dc:creator>
		<pubDate>Fri, 07 Dec 2007 10:42:11 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259786</guid>
		<description>Thorsten : Nop, you still need to use the &quot;new&quot; keyword. But still, I can&#039;t see what&#039;s the point doing that, if the user forgot to do something he * should*, why would you make up his mistake?

The more earlier an error comes out, the easier the debugging will be.</description>
		<content:encoded><![CDATA[<p>Thorsten : Nop, you still need to use the &#8220;new&#8221; keyword. But still, I can&#8217;t see what&#8217;s the point doing that, if the user forgot to do something he * should*, why would you make up his mistake?</p>
<p>The more earlier an error comes out, the easier the debugging will be.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thorsten</title>
		<link>http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript/comment-page-1#comment-259782</link>
		<dc:creator>Thorsten</dc:creator>
		<pubDate>Fri, 07 Dec 2007 07:50:07 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/archives/making-sure-you-get-new-instances-in-javascript#comment-259782</guid>
		<description>Isn&#039;t prototype using a similiar concept?</description>
		<content:encoded><![CDATA[<p>Isn&#8217;t prototype using a similiar concept?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

