<?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: Digging a real OO class system with jQuery</title>
	<atom:link href="http://ajaxian.com/archives/jquery-class/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/jquery-class</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: kchriss</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-285955</link>
		<dc:creator>kchriss</dc:creator>
		<pubDate>Thu, 03 Nov 2011 22:11:16 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-285955</guid>
		<description>&quot;I have been writing JavaScript for 8 years now, and I have never once found need to use an uber function.&quot;

Just as well, because the function Crockford published on his site (http://www.crockford.com/javascript/inheritance.html) doesn&#039;t work in the general case. Try it for more than three levels of inheritance. Caused me such a headache :(

P.S. sorry I realise this is a very old thread!</description>
		<content:encoded><![CDATA[<p>&#8220;I have been writing JavaScript for 8 years now, and I have never once found need to use an uber function.&#8221;</p>
<p>Just as well, because the function Crockford published on his site (<a href="http://www.crockford.com/javascript/inheritance.html" rel="nofollow">http://www.crockford.com/javascript/inheritance.html</a>) doesn&#8217;t work in the general case. Try it for more than three levels of inheritance. Caused me such a headache :(</p>
<p>P.S. sorry I realise this is a very old thread!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nataxia</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-271978</link>
		<dc:creator>nataxia</dc:creator>
		<pubDate>Thu, 12 Mar 2009 15:27:30 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-271978</guid>
		<description>@csuwldcat

The first and most important thing to say is that I am glad that you see the value of a consistent development model.  That being said, I leave you with some Crockford, in particular the last bit, and the thought that it is to me ridiculous to say that the most popular language in the world has a model that is hard to use:

JavaScript can be used like a classical language, but it also has a level of expressiveness which is quite unique. We have looked at Classical Inheritance, Swiss Inheritance, Parasitic Inheritance, Class Augmentation, and Object Augmentation. This large set of code reuse patterns comes from a language which is considered smaller and simpler than Java.

Classical objects are hard. The only way to add a new member to a hard object is to create a new class. In JavaScript, objects are soft. A new member can be added to a soft object by simple assignment.

Because objects in JavaScript are so flexible, you will want to think differently about class hierarchies. Deep hierarchies are inappropriate. Shallow hierarchies are efficient and expressive.

I have been writing JavaScript for 8 years now, and I have never once found need to use an uber function. The super idea is fairly important in the classical pattern, but it appears to be unnecessary in the prototypal and functional patterns. I now see my early attempts to support the classical model in JavaScript as a mistake.</description>
		<content:encoded><![CDATA[<p>@csuwldcat</p>
<p>The first and most important thing to say is that I am glad that you see the value of a consistent development model.  That being said, I leave you with some Crockford, in particular the last bit, and the thought that it is to me ridiculous to say that the most popular language in the world has a model that is hard to use:</p>
<p>JavaScript can be used like a classical language, but it also has a level of expressiveness which is quite unique. We have looked at Classical Inheritance, Swiss Inheritance, Parasitic Inheritance, Class Augmentation, and Object Augmentation. This large set of code reuse patterns comes from a language which is considered smaller and simpler than Java.</p>
<p>Classical objects are hard. The only way to add a new member to a hard object is to create a new class. In JavaScript, objects are soft. A new member can be added to a soft object by simple assignment.</p>
<p>Because objects in JavaScript are so flexible, you will want to think differently about class hierarchies. Deep hierarchies are inappropriate. Shallow hierarchies are efficient and expressive.</p>
<p>I have been writing JavaScript for 8 years now, and I have never once found need to use an uber function. The super idea is fairly important in the classical pattern, but it appears to be unnecessary in the prototypal and functional patterns. I now see my early attempts to support the classical model in JavaScript as a mistake.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: csuwldcat</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-271951</link>
		<dc:creator>csuwldcat</dc:creator>
		<pubDate>Wed, 11 Mar 2009 19:13:39 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-271951</guid>
		<description>@nataxia

I coded things in regular old script before using a lib (not for long, it sucks) and even used Mootools without digging into the Class framework for quite a while.  The thing is when I started using classes the pieces fit together so seamlessly.  Binds, mutators, chaining, binding with custom events, extensibility of the code, DRY, reuse++, modularity, class inheritance and extends, it makes it a snap to do just about anything cleanly and efficiently with little fuss.

I would never go back, ever.  Just a different world when you dig into it.</description>
		<content:encoded><![CDATA[<p>@nataxia</p>
<p>I coded things in regular old script before using a lib (not for long, it sucks) and even used Mootools without digging into the Class framework for quite a while.  The thing is when I started using classes the pieces fit together so seamlessly.  Binds, mutators, chaining, binding with custom events, extensibility of the code, DRY, reuse++, modularity, class inheritance and extends, it makes it a snap to do just about anything cleanly and efficiently with little fuss.</p>
<p>I would never go back, ever.  Just a different world when you dig into it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nataxia</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-271949</link>
		<dc:creator>nataxia</dc:creator>
		<pubDate>Wed, 11 Mar 2009 17:55:46 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-271949</guid>
		<description>Meh.  Why not just use the power of the language itself?  Could you justify to a software architect this approach? To the argument that this would create a codebase that would not work exactly (note: exactly) in the way someone from a classical OO background would expect, and would be confusing for those who weren&#039;t (ie. the massive pool of developers who are trained in javascript), what would you say?  To a recruiting manager: how would you explain that you&#039;ve architected a codebase which makes it more difficult to find cheap talent, for zero performance or other benefit?  Do you believe debugging will be more difficult by injecting this sort of inheritance into another sort of library model *on top of* a language which *both* of these layers abstract, differently?  Does the added complexity, man-hours and other negatives go away due to some benefit? And what is that benefit?</description>
		<content:encoded><![CDATA[<p>Meh.  Why not just use the power of the language itself?  Could you justify to a software architect this approach? To the argument that this would create a codebase that would not work exactly (note: exactly) in the way someone from a classical OO background would expect, and would be confusing for those who weren&#8217;t (ie. the massive pool of developers who are trained in javascript), what would you say?  To a recruiting manager: how would you explain that you&#8217;ve architected a codebase which makes it more difficult to find cheap talent, for zero performance or other benefit?  Do you believe debugging will be more difficult by injecting this sort of inheritance into another sort of library model *on top of* a language which *both* of these layers abstract, differently?  Does the added complexity, man-hours and other negatives go away due to some benefit? And what is that benefit?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: csuwldcat</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-271947</link>
		<dc:creator>csuwldcat</dc:creator>
		<pubDate>Wed, 11 Mar 2009 17:51:10 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-271947</guid>
		<description>Hmm...didn&#039;t a library have a class system in it years ago natively that rocks, keeps code organized, introduces custom events and chaining in a integrated fashion???

Oh yeah Mootools! that&#039;s right!

Here is my analogy for this article:

When IE first did tabbed browsing lay people everywhere were like &quot;Oh my god tabs how awesome.&quot;  I can vouch, I still have friends who aren&#039;t working in internet technology who think FireFox is the one doing the UI and functional copying...

So I see this post, and so many recently, in much the same way, namely: &quot;Oh my god look what you can do with jQuery, brilliant!!!&quot; - make sure to read emphatically like a guinness commercial puppet for full effect.

Using Google more would solve many problems folks, there is the whole new world out there beyond the little js lib box. (don&#039;t bust my balls over the chance Aladdin reference).  I mean I don&#039;t use jQuery much but I read John&#039;s blog sometimes and try and stay up with developments they do...</description>
		<content:encoded><![CDATA[<p>Hmm&#8230;didn&#8217;t a library have a class system in it years ago natively that rocks, keeps code organized, introduces custom events and chaining in a integrated fashion???</p>
<p>Oh yeah Mootools! that&#8217;s right!</p>
<p>Here is my analogy for this article:</p>
<p>When IE first did tabbed browsing lay people everywhere were like &#8220;Oh my god tabs how awesome.&#8221;  I can vouch, I still have friends who aren&#8217;t working in internet technology who think FireFox is the one doing the UI and functional copying&#8230;</p>
<p>So I see this post, and so many recently, in much the same way, namely: &#8220;Oh my god look what you can do with jQuery, brilliant!!!&#8221; &#8211; make sure to read emphatically like a guinness commercial puppet for full effect.</p>
<p>Using Google more would solve many problems folks, there is the whole new world out there beyond the little js lib box. (don&#8217;t bust my balls over the chance Aladdin reference).  I mean I don&#8217;t use jQuery much but I read John&#8217;s blog sometimes and try and stay up with developments they do&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: whyisjasontaken</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-271943</link>
		<dc:creator>whyisjasontaken</dc:creator>
		<pubDate>Wed, 11 Mar 2009 16:14:11 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-271943</guid>
		<description>He actually did do something similar, which is not a joke:
http://ejohn.org/blog/simple-javascript-inheritance/</description>
		<content:encoded><![CDATA[<p>He actually did do something similar, which is not a joke:<br />
<a href="http://ejohn.org/blog/simple-javascript-inheritance/" rel="nofollow">http://ejohn.org/blog/simple-javascript-inheritance/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: daitro</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-271942</link>
		<dc:creator>daitro</dc:creator>
		<pubDate>Wed, 11 Mar 2009 15:57:41 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-271942</guid>
		<description>@sixtyseconds 

forgot to use the tag [sarcasm][/sarcasm]</description>
		<content:encoded><![CDATA[<p>@sixtyseconds </p>
<p>forgot to use the tag [sarcasm][/sarcasm]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kangax</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-271939</link>
		<dc:creator>kangax</dc:creator>
		<pubDate>Wed, 11 Mar 2009 14:06:11 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-271939</guid>
		<description>That script seems to be of a doubtful quality.

&lt;code&gt;
...
if(this.constructor == Object &#124;&#124; typeof this.init != undefined) {
...
&lt;/code&gt;
The latter expression will always evaluate to `true`, since `typeof` always returns a string. Did they forget quotes around `undefined`. It&#039;s also not clear why there is a limitation of `constructor` being an Object. What if I want to pass an object that inherits from `Object.prototype` but doesn&#039;t really have `Object` as its `constructor`? It would be better to check for either [[Class]] or use `typeof`.

Another oddity:
&lt;code&gt;
$.each(ns, function() {
  _this.namespace.apply(_this, [this]);
});
&lt;/code&gt;
Nice. Creation of a useless array in a loop just to pass it to `apply`? `call` would do just fine (and faster and more memory effecient, of course)

Further down, we have:
&lt;code&gt;
...
for(i in this) {
...
&lt;/code&gt;
which obviously creates `i` in a global scope : /

And another case of inefficient array creation in a loop:
&lt;code&gt;
...
if(extendee[i] &amp;&amp; extendee[i].constructor == Function &amp;&amp; [&#039;namespace&#039;,&#039;create&#039;,&#039;sup&#039;].indexOf(i) == -1) {
...
&lt;/code&gt;

I also don&#039;t see how it&#039;s modeled after Prototype.js. Prototype.js uses `beget`-like pattern for inheritance. They, on the other hand, seem to manually iterate over methods with for/in. Those are 2 completely different approaches.

There&#039;s also no fix for JScript&#039;s DontEnum bug, which might bite them one day. I also couldn&#039;t find any unit tests...</description>
		<content:encoded><![CDATA[<p>That script seems to be of a doubtful quality.</p>
<p><code><br />
...<br />
if(this.constructor == Object || typeof this.init != undefined) {<br />
...<br />
</code><br />
The latter expression will always evaluate to `true`, since `typeof` always returns a string. Did they forget quotes around `undefined`. It&#8217;s also not clear why there is a limitation of `constructor` being an Object. What if I want to pass an object that inherits from `Object.prototype` but doesn&#8217;t really have `Object` as its `constructor`? It would be better to check for either [[Class]] or use `typeof`.</p>
<p>Another oddity:<br />
<code><br />
$.each(ns, function() {<br />
  _this.namespace.apply(_this, [this]);<br />
});<br />
</code><br />
Nice. Creation of a useless array in a loop just to pass it to `apply`? `call` would do just fine (and faster and more memory effecient, of course)</p>
<p>Further down, we have:<br />
<code><br />
...<br />
for(i in this) {<br />
...<br />
</code><br />
which obviously creates `i` in a global scope : /</p>
<p>And another case of inefficient array creation in a loop:<br />
<code><br />
...<br />
if(extendee[i] &amp;&amp; extendee[i].constructor == Function &amp;&amp; ['namespace','create','sup'].indexOf(i) == -1) {<br />
...<br />
</code></p>
<p>I also don&#8217;t see how it&#8217;s modeled after Prototype.js. Prototype.js uses `beget`-like pattern for inheritance. They, on the other hand, seem to manually iterate over methods with for/in. Those are 2 completely different approaches.</p>
<p>There&#8217;s also no fix for JScript&#8217;s DontEnum bug, which might bite them one day. I also couldn&#8217;t find any unit tests&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sixtyseconds</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-271936</link>
		<dc:creator>sixtyseconds</dc:creator>
		<pubDate>Wed, 11 Mar 2009 13:42:22 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-271936</guid>
		<description>lol @ daitro

From the source of his post:
// Happy April Fools Day 2008
// The code is good - read for inspiration, but
// please don&#039;t use this :-(</description>
		<content:encoded><![CDATA[<p>lol @ daitro</p>
<p>From the source of his post:<br />
// Happy April Fools Day 2008<br />
// The code is good &#8211; read for inspiration, but<br />
// please don&#8217;t use this :-(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: daitro</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-271935</link>
		<dc:creator>daitro</dc:creator>
		<pubDate>Wed, 11 Mar 2009 12:49:01 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-271935</guid>
		<description>been done alredy, by john himself! http://ejohn.org/blog/classy-query/</description>
		<content:encoded><![CDATA[<p>been done alredy, by john himself! <a href="http://ejohn.org/blog/classy-query/" rel="nofollow">http://ejohn.org/blog/classy-query/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Spocke</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-271931</link>
		<dc:creator>Spocke</dc:creator>
		<pubDate>Wed, 11 Mar 2009 11:22:33 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-271931</guid>
		<description>Building complex applications with inheritance is a pain if you use the strict prototypal way. Mainly because calling super class methods needs to be something like MyClass.prototype.myMethod.call(this, args); Or even worse if you use name spaces it would be something like: mylibrary.mynamespace.MyClass.prototype.myMethod.call(this, args);
when it could have been: this.parent(args); or this.Super.myMethod(args); if you use a OOP framework.</description>
		<content:encoded><![CDATA[<p>Building complex applications with inheritance is a pain if you use the strict prototypal way. Mainly because calling super class methods needs to be something like MyClass.prototype.myMethod.call(this, args); Or even worse if you use name spaces it would be something like: mylibrary.mynamespace.MyClass.prototype.myMethod.call(this, args);<br />
when it could have been: this.parent(args); or this.Super.myMethod(args); if you use a OOP framework.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JimmyP22</title>
		<link>http://ajaxian.com/archives/jquery-class/comment-page-1#comment-271930</link>
		<dc:creator>JimmyP22</dc:creator>
		<pubDate>Wed, 11 Mar 2009 11:06:18 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=6255#comment-271930</guid>
		<description>Interesting but I don&#039;t see the point in piggybacking on jQuery&#039;s abstraction? I think your class-based implementation is quite suitable on its own.

I never really understood the point in trying to make JavaScript something it&#039;s clearly not. Prototypal inheritance CANNOT go hand in hand with classical - consigning to one is the only way in my opinion.</description>
		<content:encoded><![CDATA[<p>Interesting but I don&#8217;t see the point in piggybacking on jQuery&#8217;s abstraction? I think your class-based implementation is quite suitable on its own.</p>
<p>I never really understood the point in trying to make JavaScript something it&#8217;s clearly not. Prototypal inheritance CANNOT go hand in hand with classical &#8211; consigning to one is the only way in my opinion.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

