<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>From closures to prototypes, part 2</title><link>http://weblogs.asp.net/bleroy/archive/2006/10/14/From-closures-to-prototypes_2C00_-part-2.aspx</link><description>In part 1 of this post, I exposed the differences between the closure and the prototype patterns to define JavaScript classes. In this post, I&amp;#39;ll show the shortest path to convert an existing class built using Atlas and closures to a prototype-based</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Prototype Vs Closure - optimisation d'une classe en JavaScript</title><link>http://weblogs.asp.net/bleroy/archive/2006/10/14/From-closures-to-prototypes_2C00_-part-2.aspx#4590376</link><pubDate>Tue, 16 Oct 2007 12:48:01 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:4590376</guid><dc:creator>Atteint de Javascriptite aiguë [Cyril DURAND]</dc:creator><author>Atteint de Javascriptite aiguë [Cyril DURAND]</author><description>&lt;p&gt;En JavaScript, il y a 2 grandes fa&amp;#231;ons de faire une classe : le mode prototype et le mode closure . M&amp;#233;thode&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=4590376" width="1" height="1"&gt;</description></item><item><title>ASP.NET AJAX Beta 1 and ComponentArt Web.UI</title><link>http://weblogs.asp.net/bleroy/archive/2006/10/14/From-closures-to-prototypes_2C00_-part-2.aspx#775405</link><pubDate>Tue, 31 Oct 2006 20:52:06 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:775405</guid><dc:creator>Miljan Braticevic</dc:creator><author>Miljan Braticevic</author><description>&lt;p&gt;We have recently completed converting our suite of user interface controls from the latest Community&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=775405" width="1" height="1"&gt;</description></item><item><title>Microsoft ASP.NET Extensions (Atlas) Beta 1 et ControlToolkit nouvelle version</title><link>http://weblogs.asp.net/bleroy/archive/2006/10/14/From-closures-to-prototypes_2C00_-part-2.aspx#697617</link><pubDate>Fri, 20 Oct 2006 23:29:48 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:697617</guid><dc:creator>Fox Blogs</dc:creator><author>Fox Blogs</author><description>&lt;p&gt;Pour compl&amp;#233;ter le billet de Patrice il y a la beta 1 de Microsoft ASP.NET Ajax Extentions de dispo mais&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=697617" width="1" height="1"&gt;</description></item><item><title>Bye Bye Atlas et ses CTP, Bienvenue à la Beta 1 de Microsoft Ajax !</title><link>http://weblogs.asp.net/bleroy/archive/2006/10/14/From-closures-to-prototypes_2C00_-part-2.aspx#695916</link><pubDate>Fri, 20 Oct 2006 16:30:52 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:695916</guid><dc:creator>ASP.NET Français Blogs</dc:creator><author>ASP.NET Français Blogs</author><description>&lt;p&gt;Scott Guthrie l'annonce sur son blog via un billet fort d&amp;#233;taill&amp;#233;. La version Beta 1 de Microsoft ASP.NET&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=695916" width="1" height="1"&gt;</description></item><item><title>re: From closures to prototypes, part 2</title><link>http://weblogs.asp.net/bleroy/archive/2006/10/14/From-closures-to-prototypes_2C00_-part-2.aspx#676792</link><pubDate>Tue, 17 Oct 2006 22:14:17 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:676792</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><description>&lt;p&gt;Michael, Jon: it's imminent.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=676792" width="1" height="1"&gt;</description></item><item><title>re: From closures to prototypes, part 2</title><link>http://weblogs.asp.net/bleroy/archive/2006/10/14/From-closures-to-prototypes_2C00_-part-2.aspx#676755</link><pubDate>Tue, 17 Oct 2006 22:04:23 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:676755</guid><dc:creator>Jon Flanders</dc:creator><author>Jon Flanders</author><description>Bertrand - any ideas when a public CTP using prototypes will be available?&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=676755" width="1" height="1"&gt;</description></item><item><title>re: From closures to prototypes, part 2</title><link>http://weblogs.asp.net/bleroy/archive/2006/10/14/From-closures-to-prototypes_2C00_-part-2.aspx#676062</link><pubDate>Tue, 17 Oct 2006 18:23:46 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:676062</guid><dc:creator>Michael Stuart</dc:creator><author>Michael Stuart</author><description>I had heard that the next release would be sometime this week.  Do you know if there's any truth to that prediction?  Thanks for these Atlas posts...they're very helpful.&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=676062" width="1" height="1"&gt;</description></item><item><title>re: From closures to prototypes, part 2</title><link>http://weblogs.asp.net/bleroy/archive/2006/10/14/From-closures-to-prototypes_2C00_-part-2.aspx#673261</link><pubDate>Tue, 17 Oct 2006 01:03:50 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:673261</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><description>&lt;p&gt;Rick: this in principle doesn't change anything to type descriptors, which still need additional type information. The design for type descriptors *did* change, but for different reasons. More on that later.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=673261" width="1" height="1"&gt;</description></item><item><title>re: From closures to prototypes, part 2</title><link>http://weblogs.asp.net/bleroy/archive/2006/10/14/From-closures-to-prototypes_2C00_-part-2.aspx#673229</link><pubDate>Tue, 17 Oct 2006 00:54:15 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:673229</guid><dc:creator>Rick Strahl</dc:creator><author>Rick Strahl</author><description>Bertrand, does this mean the syntax conventions will make it possible to forgo the type descriptor interface that's required in the current builds?
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=673229" width="1" height="1"&gt;</description></item><item><title>re: From closures to prototypes, part 2</title><link>http://weblogs.asp.net/bleroy/archive/2006/10/14/From-closures-to-prototypes_2C00_-part-2.aspx#673153</link><pubDate>Tue, 17 Oct 2006 00:04:34 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:673153</guid><dc:creator>Bertrand Le Roy</dc:creator><author>Bertrand Le Roy</author><description>&lt;p&gt;Ryan: from the *outside*, you need a way to tell public and private members apart. Users of your classes (and Visual Studio) must be able to determine easily if Foo.bar() or Foo._bar() is public or private.&lt;/p&gt;
&lt;p&gt;Alex: from our benchmarks, creating an instance is between 3.5 and 16 times faster depending on the browser. Firefox is getting the biggest benefits. Calling members is a little slower on all browsers (between 8 and 58 percent) because of the need to lookup on the instance, then the prototype. But the biggest benefit is in terms of working set with the prototype model taking about 30 times less memory than closures. Finally, parsing times are about twice as fast on IE with closures, and four times as fast with prototypes on Firefox.&lt;/p&gt;
&lt;p&gt;So all in all, closures are generally a little faster on IE, but prototypes really shine on Firefox. All this was with IE6 but I don't think the JavaScript engine was changed in IE7.&lt;/p&gt;
&lt;p&gt;Of course, all those are micro-benchmarks so your mileage may vary, depending on your type of application.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=673153" width="1" height="1"&gt;</description></item></channel></rss>