<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Il y a du thé renversé au bord de la table</title>
	<atom:link href="http://dutherenverseauborddelatable.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dutherenverseauborddelatable.wordpress.com</link>
	<description>De l&#039;informatique, d&#039;intenses réflexions et quelques autres absurdités</description>
	<lastBuildDate>Thu, 19 Jan 2012 13:39:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dutherenverseauborddelatable.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Il y a du thé renversé au bord de la table</title>
		<link>http://dutherenverseauborddelatable.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dutherenverseauborddelatable.wordpress.com/osd.xml" title="Il y a du thé renversé au bord de la table" />
	<atom:link rel='hub' href='http://dutherenverseauborddelatable.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Back to white</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2012/01/19/back-to-white/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2012/01/19/back-to-white/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 11:31:53 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
		
		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=1061</guid>
		<description><![CDATA[After one day in black, this blog is returning to its normal colors.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=1061&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After <a title="Resist SOPA, HADOPI, Censorship…" href="http://dutherenverseauborddelatable.wordpress.com/2012/01/18/against-sopa/">one day in black</a>, this blog is returning to its normal colors.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/1061/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/1061/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/1061/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/1061/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dutherenverseauborddelatable.wordpress.com/1061/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dutherenverseauborddelatable.wordpress.com/1061/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dutherenverseauborddelatable.wordpress.com/1061/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dutherenverseauborddelatable.wordpress.com/1061/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/1061/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/1061/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/1061/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/1061/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/1061/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/1061/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=1061&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2012/01/19/back-to-white/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>Resist SOPA, HADOPI, Censorship&#8230;</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2012/01/18/against-sopa/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2012/01/18/against-sopa/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 06:02:39 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[Société]]></category>
		<category><![CDATA[censorship]]></category>
		<category><![CDATA[hadopi]]></category>
		<category><![CDATA[sopa]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=1054</guid>
		<description><![CDATA[Today, this blog is black. Today is an international day of fighting against web censorship. Against SOPA (in the US), Hadopi (in France), and all the bills that assume that freedom of expression and freedom of information can be cast aside whenever they come in the way of profit. Learn more.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=1054&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:center;">Today, this blog is black.</p>
<p style="text-align:center;">Today is an international day of fighting against web censorship.</p>
<p style="text-align:center;">Against SOPA (in the US), Hadopi (in France), and all the bills that assume that freedom of expression and freedom of information can be cast aside whenever they come in the way of profit.</p>
<p style="text-align:center;">Learn <a href="http://en.wikipedia.org/wiki/Wikipedia:SOPA_initiative/Learn_more">more</a>.</p>
<p style="text-align:center;"><a href="http://arstechnica.com/staff/palatine/2012/01/sopa-resistance-day-begins-at-ars.ars"><img class="aligncenter size-full wp-image-1055" title="sopa-fist-4f1634a-intro-thumb-640xauto-29483" src="http://dutherenverseauborddelatable.files.wordpress.com/2012/01/sopa-fist-4f1634a-intro-thumb-640xauto-29483.jpg?w=480" alt="Image from Ars Technica: http://arstechnica.com/staff/palatine/2012/01/sopa-resistance-day-begins-at-ars.ars"   /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/1054/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/1054/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/1054/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/1054/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dutherenverseauborddelatable.wordpress.com/1054/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dutherenverseauborddelatable.wordpress.com/1054/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dutherenverseauborddelatable.wordpress.com/1054/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dutherenverseauborddelatable.wordpress.com/1054/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/1054/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/1054/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/1054/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/1054/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/1054/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/1054/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=1054&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2012/01/18/against-sopa/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>

		<media:content url="http://dutherenverseauborddelatable.files.wordpress.com/2012/01/sopa-fist-4f1634a-intro-thumb-640xauto-29483.jpg" medium="image">
			<media:title type="html">sopa-fist-4f1634a-intro-thumb-640xauto-29483</media:title>
		</media:content>
	</item>
		<item>
		<title>Call For Classrooms</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2012/01/17/call-for-classrooms/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2012/01/17/call-for-classrooms/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 09:54:55 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Enseignement]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[open web]]></category>
		<category><![CDATA[participative web]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=1042</guid>
		<description><![CDATA[(and Researchers, Professors, Teachers, Students &#8230;) Mozilla is working with numerous educators, professors and researchers across the world, both to bring open-source, the open web and web technologies into the classroom, and to bring the contributions of students and their mentors to the world. You can be a part of this, and your field does [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=1042&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:right;">(and Researchers, Professors, Teachers, Students &#8230;)</p>
<p style="text-align:justify;"><em>Mozilla is working with numerous educators, professors and researchers across the world, both to bring open-source, the open web and web technologies into the classroom, and to bring the contributions of students and their mentors to the world. You can be a part of this, and your field does not have to be Computer Science.</em></p>
<p style="text-align:justify;"><em><span id="more-1042"></span><br />
</em></p>
<h2 style="text-align:justify;">Mozilla in the classroom – and beyond</h2>
<p style="text-align:justify;">Mozilla? Certainly, you have heard about us. Mozilla is best known for its work on <a title="OS.File, step-by-step: The Schedule API" href="http://getfirefox.com">the Firefox web browser</a> and <a title="OS.File, step-by-step: The Schedule API" href="http://getfirefox.com">the Thunderbird mail client</a> but that is not all there is to Mozilla, far from it. The activities of Mozilla reach largely beyond a few software products. The objective of the Mozilla project is to promote an <em>open</em>, <em>participative</em> web. For this purpose, we have developed and promoted Firefox, Thunderbird, open standards, add-ons, and countless experiments and innovations. For this purpose, we want to work with you.</p>
<p style="text-align:justify;">This is a call for academics and students. We would like to work with you, with your classrooms and with your labs.</p>
<p style="text-align:justify;">Mozilla is already present in numerous classrooms and research laboratories around the world, thanks to collaboration of numerous educators, professors, researchers and students. We deliver courses, we provide teaching material, but most importantly, we provide opportunities for students and their mentors: the opportunity to make impacting contributions to the web, to open-source and sometimes to society, the opportunity to tinker with technologies used by hundreds and millions of people, and to deliver research results to an audience consisting in the the whole web, and also, most importantly, the opportunity to learn and teach as part of an exciting, participatory and fun community.</p>
<p style="text-align:justify;">So, whether you are an academic or a student, if you want to work alongside us, please contact contact us.</p>
<h2>Topics of interest</h2>
<p style="text-align:justify;">At its core, Mozilla is an open-source community. Our work at Mozilla covers many topics. Some of these topics are extremely technical, some do not even involve a computer.</p>
<p>Here are but a few.</p>
<h3>Open-source (Software Engineering, IT, CS Research, UX)&#8230;</h3>
<ul>
<li>client-side programming in C, C++, JavaScript, Java;</li>
<li>server-side programming in Python, JavaScript;</li>
<li>concurrent and system-oriented programming;</li>
<li>implementation of programming languages;</li>
<li>static analysis, rewriting and semantics or programming languages;</li>
<li>instrumentation, dynamic analysis;</li>
<li>distributed, scalable databases;</li>
<li>distributed, scalable web services;</li>
<li>client-side web security;</li>
<li>server-side web security;</li>
<li>network security;</li>
<li>network maintenance;</li>
<li>applied cryptography;</li>
<li>implementation of cryptographic protocols;</li>
<li>establishing and maintaining mirrors;</li>
<li>service-oriented architectures;</li>
<li>low-level, 2d graphics programming;</li>
<li>low-level, 3d graphics programming;</li>
<li>implementing typography and layouts;</li>
<li>defining typography and layouts;</li>
<li>developing user interfaces;</li>
<li>designing user interfaces;</li>
<li>web applications;</li>
<li>video game development;</li>
<li>build systems;</li>
<li>tools for developers;</li>
<li>data mining from bugzilla, survey results, etc;</li>
<li>implementing web standards;</li>
<li>designing candidate web standards;</li>
<li>privacy analysis;</li>
<li>operating system development;</li>
<li>&#8230;</li>
</ul>
<h3></h3>
<h3>&#8230; community (Internationalization, Events, Representing Mozilla)</h3>
<ul>
<li>internationalizing Mozilla and other community applications;</li>
<li>internationalizing Mozilla and other community websites;</li>
<li>organizing local or global open-source events;</li>
<li>&#8230; or web events;</li>
<li>&#8230; or technology events;</li>
<li>participating to local or global events;</li>
<li>teaching the open web to non-technical audiences;</li>
<li>teaching the open web to technical audiences;</li>
<li>teaching web technologies;</li>
<li>organizing local communities;</li>
<li>spreading Mozilla and other open-source technologies;</li>
<li>providing technical support in the local language;</li>
<li>representing Mozilla in a highschool/university/&#8230;;</li>
<li>communicating with local media;</li>
<li>analyzing industry news;</li>
<li>advocating open web or open-source to local companies, organizations and communities;</li>
<li>interacting with other technology communities;</li>
<li>writing articles on open-source and the open web;</li>
<li>&#8230; or filming documentaries;</li>
<li>&#8230; or anything else you can think of!</li>
</ul>
<h2>What the Mozilla community can do for you</h2>
<p style="text-align:justify;">On some topics, Mozilla can provide you with teaching/learning material or get you in touch with Mozillians who would love to come to your classroom and deliver interventions or lectures.</p>
<p style="text-align:justify;">More importantly, we can help shape student projects and we can contribute to mentoring them. Do not limit yourself – with enough dedication, student projects can change the world.</p>
<p style="text-align:justify;">If you are interested, please get in touch.</p>
<p>You can reach me by e-mail at mozilla.com, as dteller.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/1042/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/1042/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/1042/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/1042/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dutherenverseauborddelatable.wordpress.com/1042/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dutherenverseauborddelatable.wordpress.com/1042/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dutherenverseauborddelatable.wordpress.com/1042/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dutherenverseauborddelatable.wordpress.com/1042/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/1042/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/1042/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/1042/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/1042/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/1042/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/1042/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=1042&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2012/01/17/call-for-classrooms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>OS.File, step-by-step: The Schedule API</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2011/12/13/os-file-step-by-step-the-schedule-api/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2011/12/13/os-file-step-by-step-the-schedule-api/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 09:23:12 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[mozilla platform]]></category>
		<category><![CDATA[OS.File]]></category>
		<category><![CDATA[scheduler]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=1017</guid>
		<description><![CDATA[Summary One of the key components of OS.File is the Schedule API, a tiny yet powerful JavaScript core designed to considerably simplify the development of asynchronous modules. In this post, we introduce the Schedule API. Introduction In a previous post, I introduced OS.File, a Mozilla Platform library designed make the life of developers easier and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=1017&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 style="text-align:justify;">Summary</h2>
<p style="text-align:justify;"><em>One of the key components of <code>OS.File</code> is the Schedule API, a tiny yet powerful JavaScript core designed to considerably simplify the development of asynchronous modules. In this post, we introduce the Schedule API.<br />
</em></p>
<h2 style="text-align:justify;">Introduction</h2>
<p style="text-align:justify;">In a previous post, I introduced <a title="Introducing JavaScript native file management" href="http://dutherenverseauborddelatable.wordpress.com/2011/12/06/introducing-javascript-native-file-management/"><code>OS.File</code></a>, a Mozilla Platform library designed make the life of developers easier and to help them produce high-performance, high-responsiveness file management routines.</p>
<p style="text-align:justify;">In this post, I would like to concentrate on one of the core items of <code>OS.File</code>: the Schedule API. Note that the Schedule API is not limited to <code>OS.File</code> and is designed to be useful for all sorts of other modules.</p>
<p style="text-align:justify;"><span id="more-1017"></span></p>
<h2 style="text-align:justify;">Overview</h2>
<p style="text-align:justify;">One of the most important aspect of any user-facing application is its responsiveness. Contrary to intuition, however, responsiveness is much less a matter of speed than one of <em>tempo</em>: not necessarily attempting to perform tasks as fast as possible, but rather attempting to perform them in a manner that does not disrupt the user experience. In the Mozilla Platform, disrupting the user experience is synonymous with freezing the user interface.</p>
<p style="text-align:justify;">Avoiding this is the art of <em>asynchronous</em>, <em>non-blocking</em> operations, and this is the reason we built the Schedule API.</p>
<p style="text-align:justify;">The Schedule API is a tiny JavaScript module designed to simplify considerably the development of asynchronous code. It is based on Joseph Walker&#8217;s excellent Promises API [<a href="#footnote_1">1</a>] and it lies at the core of OS.File&#8217;s asynchronous operations.</p>
<p style="text-align:justify;">Before detailing the full API, let us start with a few simple examples. Consider a common situation: some treatment needs to be done soon, but not immediately, as this would otherwise disrupt the user experience. For this purpose, JavaScript offers function setTimeout, which <em>schedules</em> the execution of the treatment to later:</p>
<p><pre class="brush: jscript;">
function doItLater() {
  window.setTimeout(function() {
    var result = fibonacci(10);
  });//Schedule the execution for later
}//Wait, how do we get the result?
</pre></p>
<p style="text-align:justify;">However, <code>setTimeout</code> offers no help for informing the rest of the code that the execution is complete. While there are many solutions to this problem – I am sure that dozens can be found on StackOverflow – perhaps the most developer-friendly is that of promises:</p>
<p><pre class="brush: jscript;">
function doItLater() {
  var promise = new Promise();
  window.setTimeout(function() {
    var result = fibonacci(10);
    promise.resolve(result);
  });//Schedule the execution for later
  return promise;//And return immediately a promise.
}
</pre></p>
<p style="text-align:justify;">With this code, we have introduced the <em>promise</em> of a future result. Once we have obtained a promise, we can simply add a reaction that will be triggered once the promise is resolved:</p>
<p><pre class="brush: jscript;">
doItLater().then(function(result) {
   alert(&quot;I have just finished computing Fibonacci: &quot;+result);
})
</pre></p>
<p style="text-align:justify;">Or we can chain promises to obtain other promises:</p>
<p><pre class="brush: jscript;">
var promise2 = doItLater().chainPromise(function(result) {
   return sieve(result);
})
</pre></p>
<p style="text-align:justify;">Note that these two extracts are compatible with each other. If we write both, we will be informed once the first treatment is complete and a second treatment will also take place immediately, one whose result is promised as <code>promise2</code>.</p>
<p style="text-align:justify;">Unfortunately, a few problems appear with our code. Firstly, <code>window.setTimeout</code> is unfortunately not available in all contexts. While workarounds are available for non-UI modules and background threads, writing any reusable asynchronous is a somewhat painful that can quickly lead to unreadable code. Chaining such treatments becomes even worse.</p>
<p style="text-align:justify;">The second issue is that our call <code>fibonacci(10)</code> might well be quite long itself and might very well disrupt the user experience if we do nothing about it.</p>
<p style="text-align:justify;">Let us start by addressing the first issue, with the Schedule module:</p>
<p><pre class="brush: jscript;">
Components.utils.import(&quot;resource://gre/modules/schedule.jsm&quot;);
</pre></p>
<p style="text-align:justify;">Function <code>Schedule.soon</code> replace most uses of <code>window.setTimeout</code>:</p>
<p><pre class="brush: jscript;">
function doItLater() {
  return Schedule.soon(function() {
    return fibonacci(10);
  });
}
</pre></p>
<p style="text-align:justify;">Or, more concisely:</p>
<p><pre class="brush: jscript;">
function doItLater() {
  return Schedule.soon(fibonacci, 10);
}
</pre></p>
<p style="text-align:justify;">Or, to delay the execution of the task by 100ms:</p>
<p><pre class="brush: jscript;">
function doItLater() {
  return Schedule.soon({delay: 100}, fibonacci, 10);
}
</pre></p>
<p style="text-align:justify;">The Schedule API also extends Promises with a new method <code>soon</code>:</p>
<p><pre class="brush: jscript;">
var promise2 = doItLater().soon(function(result) {
   return sieve(result);
})
</pre></p>
<p style="text-align:justify;">Just like <code>chainPromises</code>, <code>soon</code> adds new treatments that are triggered only once the promise is resolved. However, and by opposition to <code>chainPromises</code>, these treatments are executed later, without disrupting the user experience.</p>
<p style="text-align:justify;">With the combination of Schedule and Promises, it is easy to see how we could write a version of the Fibonacci function that is computed progressively:</p>
<p><pre class="brush: jscript;">
//Compute the fibonacci function of n, as a background task
function fibo(n) {
  if (n == 1 | n == 0) {
    return Schedule.alreadyComplete(1);
    //Promise a result and deliver it immediately
  } else {
    var tasks = [];//Launch two tasks
    tasks.push(fibo(n - 1));
    tasks.push(fibo(n - 2));
    return Promise.group(tasks).soon(function(results) {
       return results[0] + results[1];
    })
  }
}
</pre></p>
<p style="text-align:justify;">Nice, readable and non-disruptive. Plus, for debugging purposes, or if you wish to add some visual feedback, you can attach additional observers to promises.</p>
<h2 style="text-align:justify;">The API</h2>
<p style="text-align:justify;">So far, we have made use of the following functions of the Promises API:</p>
<ul style="text-align:justify;">
<li><code>Promise</code>;</li>
<li><code>Promise.resolve</code>;</li>
<li><code>Promise.prototype.chainPromise</code>;</li>
<li><code>Promise.prototype.then</code>;</li>
<li><code>Promise.group</code>;</li>
</ul>
<p style="text-align:justify;">I am trying to convince Joseph to blog about this very nice API, so you should be able to learn more about it <a href="http://incompleteness.me/mozblog/">on his blog</a>, one of these days.</p>
<p style="text-align:justify;">We have also made use of the following functions of module Schedule:</p>
<ul style="text-align:justify;">
<li><code>Schedule.soon</code>;</li>
<li><code>Promise.prototype.soon</code>;</li>
<li><code>Schedule.alreadyComplete</code>.</li>
</ul>
<p style="text-align:justify;">While these methods can already be very useful to help you write or rewrite asynchronous code, the Schedule API goes a little bit further and introduces Scheduling Categories and Rendez-vous points.</p>
<h3 style="text-align:justify;">Categories</h3>
<p style="text-align:justify;">While interleaving tasks is a good way to ensure that all tasks progress, some tasks need a little tighter control. Typically, the result of successive operations on a file depend on their order of execution – closing a file before reading from it is generally not a very good idea. Similarly, for performance reasons, an application should generally avoid reading from several files simultaneously, as this can slow down not only the application but the whole system.</p>
<p style="text-align:justify;">In the Schedule API, this is materialized as Scheduling Categories. When several tasks are placed in the same category, any call to <code>Schedule.soon</code> or <code>Promise.prototype.soon</code> guarantees that these tasks will be executed in the order in which they were added and that only one of these task is executed at a time. This does not prevent tasks from other categories from being interleaved.</p>
<p style="text-align:justify;">If, for instance, we wish to serialize the computation of Fibonacci&#8217;s function, we may declare a category as follows:</p>
<p><pre class="brush: jscript;">
var Fibo = new Schedule.Category(&quot;Fibonacci's function&quot;);
</pre></p>
<p style="text-align:justify;">and replace the final function call of the previous listing with</p>
<p><pre class="brush: jscript;">
    soon({category: Fibo}, function(results) {
       return results[0] + results[1];
    })
</pre></p>
<p style="text-align:justify;">Thus categorized, Fibonacci&#8217;s functions will take less resources to compute, and will be even nicer to the rest of the application and the system, though the total computation will probably last a little longer.</p>
<h3 style="text-align:justify;">Rendez-vous</h3>
<p style="text-align:justify;">One of the original reasons for which we started developing the Schedule API was to simplify asynchronous initialization on the Mozilla Platform and ensure that whichever parts of initialization were not strictly required at start-up could be simply and safely postponed.</p>
<p style="text-align:justify;">For this purpose, the Schedule API provides one additional function: <code>Schedule.on</code>. This function lets developers register code to be executed only once some condition is met, as follows:</p>
<p><pre class="brush: jscript;">
Schedule.on(&quot;startup-complete&quot;).soon(delayedInitializer);
</pre></p>
<p style="text-align:justify;">With this line, function <code>delayedInitializer</code> will be executed only once &#8220;startup-complete&#8221; is resolved. Note that, by opposition to DOM-style events, if &#8220;startup-complete&#8221; has already been resolved, <code>delayedInitializer</code> will be immediately scheduled for execution. This simple change solves a number of refactoring headaches.</p>
<p style="text-align:justify;">By the way, <code>Schedule.on("startup-complete")</code> is just a promise. To resolve it, simply call <code>resolve</code>:</p>
<p><pre class="brush: jscript;">
Schedule.on(&quot;startup-complete&quot;).resolve();
</pre></p>
<p style="text-align:justify;">And that&#8217;s it. Welcome to the Schedule API!</p>
<h2 style="text-align:justify;">Status</h2>
<p style="text-align:justify;">Everything that was presented in this post is implemented, unit-tested – although not battle-tested – used in <code>OS.File</code>, and currently under review. There is no ETA yet, due to dependencies, but I hope that we will be able to push it soon.</p>
<p style="text-align:justify;">There is one important feature that I wish to add at some point: multi-threading. While there are limitations to what we can transmit between threads, there is no reason for which we could not schedule code for execution not on the main thread, but on a pool of workers. There will be limitations, but I believe that I have a pretty good idea of how to implement this, and if I succeed, this can expand considerably our horizons. I have small chunks of code written, but no ETA for a prototype.</p>
<h2 style="text-align:justify;">Wrapping this up</h2>
<p style="text-align:justify;">The Schedule API is a simple module (only 5 public functions) designed to make our life easier when writing asynchronous code or refactoring code for asynchronicity.</p>
<p style="text-align:justify;">I hope that you will find it useful.</p>
<p style="text-align:justify;"><a name="footnote_1"></a>[1] Thanks to Panos for point this code to me. I had previously reimplemented my own brand of Promises, but having two of them in the Mozilla Platform codebase was simply pointless.</p>
<p><strong>edit</strong> Clarified the fact that calling <code>fibonacci(10)</code> in a setTimeout will not magically make everything non-disruptive. Thanks for the feedback, Axel.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/1017/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/1017/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/1017/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/1017/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dutherenverseauborddelatable.wordpress.com/1017/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dutherenverseauborddelatable.wordpress.com/1017/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dutherenverseauborddelatable.wordpress.com/1017/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dutherenverseauborddelatable.wordpress.com/1017/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/1017/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/1017/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/1017/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/1017/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/1017/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/1017/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=1017&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2011/12/13/os-file-step-by-step-the-schedule-api/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>Introducing JavaScript native file management</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2011/12/06/introducing-javascript-native-file-management/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2011/12/06/introducing-javascript-native-file-management/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 10:52:24 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[asynchronous]]></category>
		<category><![CDATA[bsd]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[file system]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[macos]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[mozilla platform]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[platform]]></category>
		<category><![CDATA[posix]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[promise]]></category>
		<category><![CDATA[responsiveness]]></category>
		<category><![CDATA[snappy]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[threads]]></category>
		<category><![CDATA[webapi]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=975</guid>
		<description><![CDATA[Summary The Mozilla Platform keeps improving: JavaScript native file management is an undergoing work to provide a high-performance JavaScript-friendly API to manipulate the file system. The Mozilla Platform, JavaScript and Files The Mozilla Platform is the application development framework behind Firefox, Thunderbird, Instantbird, Camino, Songbird and a number of other applications. While the performance-critical components [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=975&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 style="text-align:justify;"></h2>
<h2 style="text-align:justify;">Summary</h2>
<p style="text-align:justify;"><em>The Mozilla Platform keeps improving: JavaScript native file management is an undergoing work to provide a high-performance JavaScript-friendly API to manipulate the file system.</em></p>
<h2 style="text-align:justify;">The Mozilla Platform, JavaScript and Files</h2>
<p style="text-align:justify;">The <a href="https://developer.mozilla.org/en/The_Mozilla_platform">Mozilla Platform</a> is the application development framework behind <a href="http://getfirefox.com">Firefox</a>, <a href="http://getthunderbird.com">Thunderbird</a>, <a href="http://instantbird.com">Instantbird</a>, <a href="http://caminobrowser.org">Camino</a>, <a href="http://getsongbird.com">Songbird</a> and a number of other applications.</p>
<p style="text-align:justify;">While the performance-critical components of the Mozilla Platform are developed in C/C++, an increasing number of components and add-ons are implemented in pure JavaScript. While JavaScript cannot hope to match the speed or robustness of C++ yet (edit: at least not on all aspects), the richness and dynamism of the language permit the creation of extremely flexible and developer-friendly APIs, as well as quick prototyping and concise implementation of complex algorithms without the fear of memory errors and with features such as higher-level programming, asynchronous programming and now clean and efficient multi-threading. If you combine this with the impressive speed-ups experienced by JavaScript in the recent years, it is easy to understand why the language has become a key element in the current effort to make the Mozilla Platform and its add-ons faster and more responsive at all levels.</p>
<p style="text-align:justify;"><span id="more-975"></span></p>
<p style="text-align:justify;">Many improvements to the JavaScript platform are pushing the boundary of what can be done in JavaScript. Core Modules, strict mode and the let construct are powerful tools that empower developers to produce reusable, clean and safe JavaScript libraries. The Mozilla Platform offers <a href="https://developer.mozilla.org/en/XPConnect">XPConnect</a> and now <a href="https://developer.mozilla.org/en/js-ctypes/">js-ctypes</a>, two extremely powerful technologies that let <em>privileged</em> JavaScript maskerade as C/C++ and get access to the low-level features of the platform. Other technologies such as the <a href="https://developer.mozilla.org/en/DOM/ChromeWorker">Web Workers</a> expose low-level operating system features through fast, JavaScript-friendly APIs (note that the Mozilla Platform has exposed threads and processes to JavaScript at least since 2005 – Web Workers are faster, nicer, and play much more nicely with the runtime, in particular with respect to garbage-collection and the memory model).</p>
<p style="text-align:justify;">Today, I would like to introduce one such improvement: <em>native file management</em> for JavaScript, also known as <code>OS.File</code>.</p>
<p style="text-align:justify;">Since JavaScript has become a key component to the Mozilla Platform, the Mozilla Platform needs a great library for manipulating files in JavaScript. While both XPConnect and JS-ctypes can (and have been) used for this purpose, our objective, with this library, is to go way beyond the file management APIs that has been exposed to JavaScript so far, regardless of the platform, in terms of:</p>
<ul style="text-align:justify;">
<li>expressiveness;</li>
<li>integration with the JavaScript side of the Mozilla Platform;</li>
<li>operating system-level features;</li>
<li>performance;</li>
<li>extensibility.</li>
</ul>
<p style="text-align:justify;">This library is a work in progress by the Mozilla Performance Team, and we have good hope that a fully working prototype will be available by early January. Not everything is implemented yet and all sorts of adjustments can yet be made based on your feedback.</p>
<p style="text-align:justify;">Once we have delivered, it is our hope that you will use this library for your future works on the Mozilla Platform, whether you are extending the Mozilla Platform, developing an add-on or an application, or refactoring some existing feature.</p>
<p style="text-align:justify;">Let me emphasize that this is a Mozilla Platform API (hence the &#8220;OS&#8221; prefix), not a Web API. By opposition to the HTML5 File object, this API gives full access to the system, without any security limitation, and is definitely not meant to be scriptable by web applications, under any circumstance.</p>
<h2 style="text-align:justify;"></h2>
<h2 style="text-align:justify;">Manipulating files, the JavaScript way</h2>
<h3 style="text-align:justify;">Reading from a file</h3>
<p style="text-align:justify;">Let us start with something simple: reading from a file.</p>
<p style="text-align:justify;">First, open the library:</p>
<p><pre class="brush: jscript;">
Components.utils.import(&quot;resource://gre/modules/osfile.jsm&quot;);
</pre></p>
<p style="text-align:justify;"><code>OS.File</code> is a JavaScript module, in other words it is shared between all users in the same thread. This is particularly important for speed, as this gives us the ability to perform aggressive caching of certain data.</p>
<p style="text-align:justify;">Once you have opened the module, you may read your file:</p>
<p><pre class="brush: jscript;">
var fileName = &quot;/home/yoric/hello&quot;;
var contents = OS.File.openForReading.using(fileName, function(myFile) {
  return myFile.readString()
});
</pre></p>
<p style="text-align:justify;">This extract:</p>
<ul style="text-align:justify;">
<li>opens file <code>"/home/yoric/hello"</code> for reading;</li>
<li>reads the contents of the file as a string (assuming ASCII encoding);</li>
<li>closes the file;</li>
<li>reports an error if anything wrong has happened either during opening or during reading;</li>
<li>places the result in variable <code>contents</code>.</li>
</ul>
<p style="text-align:justify;">This short listing already demonstrates a few interesting elements of the API. Firstly, notice the use of function <code>using</code>. This function performs scope-bound resource management to ensure that the file is properly closed once it has become unneeded, even in presence of errors. This has roughly the same role as a <code>finally</code> block in Java or a destructor on a C++ auto-pointer. I will return to the topic of resource management later. For the moment, suffices to say that closing a file through <code>using</code> or method close is optional but recommended, as open files are a limited resource on all operating systems.</p>
<p style="text-align:justify;">Had we decided to entrust JavaScript to close the file by itself at some point in the future, we could have simply written:</p>
<p><pre class="brush: jscript;">
var fileName = &quot;/home/yoric/hello&quot;;
var contents = OS.File.openForReading(fileName).readString();
</pre></p>
<p style="text-align:justify;">Secondly, consider <code>OS.File.openForReading</code>. As its name suggests, this function/object serves to open an existing file for reading, and it fails if the file does not exist yet. The API provides such functions for all common scenarios, all of which accept optional flags to customize Unix-style file rights, Windows-style sharing properties and other Unix- or Windows-style attributes. Alternatively, function/object/constructor <code>OS.File</code> is the general manner of controlling all details of file opening.</p>
<p style="text-align:justify;">The extracts above do not demonstrate any feature that could not have been achieved with XPConnect. However, let us briefly compare our extracts with an XPConnect-based implementation using similar lines:</p>
<ul style="text-align:justify;">
<li>the <code>OS.File</code> implementation consists of 2 to 4 lines, including resource cleanup and error-handling / a comparable XPConnect-based implementation requires about 30 lines;</li>
<li>the <code>OS.File</code> implementation works both in the main thread or in a background thread / a comparable XPConnect-based implementation works only in the main thread;</li>
<li>benchmarks are not available yet, but I have hope that the <code>OS.File</code> implementation should be slightly faster due to a lower overhead and an optimized implementation of readString;</li>
<li>in case of error, the <code>OS.File</code> implementation raises an exception with constructor <code>OS.File.Error</code> / the XPConnect-based implementation raises a generic XPConnect exception;</li>
<li>if the file does not exist, the <code>OS.File</code> implementation raises an error while executing <code>OS.File.openForReading</code> / the XPConnect-based implementation raises an error later in the process;</li>
<li>if executed on the main thread, the <code>OS.File</code> implementation will print a warning.</li>
</ul>
<p style="text-align:justify;">Note that <code>OS.File</code> manipulates <code>this</code> and closures in the JavaScript fashion, which makes it possible to make our extracts even more concise, as follows:</p>
<p><pre class="brush: jscript;">
var fileName = &quot;/home/yoric/hello&quot;;
var contents = OS.File.openForReading.using(fileName, function() {
  return this.readString();
});
</pre></p>
<p style="text-align:justify;">or, equivalently,</p>
<p><pre class="brush: jscript;">
var fileName = &quot;/home/yoric/hello&quot;;
var contents = OS.File.openForReading.using(fileName,
  OS.File.prototype.readString);
</pre></p>
<p style="text-align:justify;">Of course, <code>OS.File</code> is not limited to strings. Indeed, to return a typed array, simply replace <code>readString</code> with <code>readBuffer</code>. For better performance, it is also possible to reuse an existing buffer. This is done by replacing <code>readBuffer</code> with <code>readTo</code>.</p>
<p style="text-align:justify;">Also, <code>OS.File</code> is not limited to reading entire files. Indeed, all read/write functions accept an optional argument that may be used to determine a subset of the file that must be read:</p>
<p><pre class="brush: jscript;">
var fileName = &quot;/home/yoric/hello&quot;;
var contents = OS.File.openForReading.using(fileName,
  {fileOffset: 10, bytes: 100},
  OS.File.prototype.readString);
</pre></p>
<h3 style="text-align:justify;">Well-known directories</h3>
<p style="text-align:justify;">The operations we have demonstrated so far use an hard-coded path &#8220;/home/yoric/hello&#8221;. This is not a very good idea, as this path is valid only under Linux, but not under Windows or MacOS. Therefore, we certainly prefer asking the Mozilla Platform to select the path for us. For this purpose, we may replace the first line with:</p>
<p><pre class="brush: jscript;">
var fileName = OS.Path.home.get(&quot;hello&quot;);
</pre></p>
<p style="text-align:justify;">This extract:</p>
<ul style="text-align:justify;">
<li>uses global object <code>OS.Path</code> (part of library <code>OS.File</code>);</li>
<li>requests the path to the user&#8217;s home directory;</li>
<li>requests item <code>"hello"</code> at this path.</li>
</ul>
<p style="text-align:justify;">The extract demonstrates a few things. Firstly, the use of <code>OS.Path</code>. This object contains paths to well-known directories, and can be extended with new directories. Each path has constructor <code>OS.Path</code>, and supports a method get that serves to enter into files/directories. Secondly, the use of <code>OS.Path</code> as a path for functions of module <code>OS.File</code>: any function of this module accepts an <code>OS.Path</code> in place of a hard-coded directory.</p>
<p style="text-align:justify;">Note that <code>OS.Path</code> objects are purely in-memory constructs. Building an <code>OS.Path</code> does not cause any call to the file system.</p>
<p style="text-align:justify;">As previously, something similar is feasible with XPConnect. Comparing with a XPConnect-based implementation, we may notice that:</p>
<ul style="text-align:justify;">
<li>the <code>OS.File</code> implementation consists of 1 line / a comparable XPConnect-based implementation consists of 1 to 4 lines, depending on the use of additional libraries;</li>
<li>the <code>OS.File</code> implementation works both in the main thread and in a background thread / again, XPConnect works only in the main thread;</li>
<li>benchmarks are not available yet, but I have hope that the <code>OS.File</code> implementation should be slightly faster due to a lower overhead and use of caching.</li>
</ul>
<h3 style="text-align:justify;"></h3>
<h3 style="text-align:justify;">Behaving nicely</h3>
<p style="text-align:justify;">The operations we have demonstrated so far are synchronous. This is probably not problematic for file opening, but reading a large file synchronously from the main thread is a very bad idea, as it will freeze the user interface until completed. It is therefore a good idea to either send the operation to a background thread or to ensure that reading takes place by small chunks.</p>
<p style="text-align:justify;"><code>OS.File</code> supports both scenarios by integrating with (work-in-progress) libraries Promise and Schedule, both of which will be introduced in another post, once their API has stabilized.</p>
<p style="text-align:justify;">The first step to reading asynchronously is to open library Promise. We will take the opportunity to open Schedule</p>
<p><pre class="brush: jscript;">
Components.utils.import(&quot;resource://gre/modules/promise.jsm&quot;);
Components.utils.import(&quot;resource://gre/modules/schedule.jsm&quot;);
</pre></p>
<p style="text-align:justify;">Now that the module is open, we may use asynchronous reading and asynchronous writing functions:</p>
<p><pre class="brush: jscript;">
var promisedContents = OS.File.openForReading(fileName).
    readString.async();
</pre></p>
<p style="text-align:justify;">This operation schedules progressive reading of the file and immediately returns. Note that we do not close the file, as this would stop reading, probably before the operation is complete. The result of the operation, <code>promisedContents</code>, is a Promise, i.e. a variable that will eventually contain a value, and that may be observed or  polled, as follows:</p>
<p><pre class="brush: jscript;">
promisedContents.onsuccess(function(contents) {
  console.log(&quot;It worked&quot;, contents);
});
promisedContents.onerror(function(error) {
  console.log(&quot;It failed&quot;, error);
});
</pre></p>
<p style="text-align:justify;">Similarly, reading from a background thread is a simple operation:</p>
<p><pre class="brush: jscript;">
var promisedContents = Schedule.bg(function() {
  importScripts(&quot;resource://gre/modules/osfile.jsm&quot;);
  var fileName = &quot;/home/yoric/hello&quot;;
  return OS.File.openForReading.using(fileName, function(myFile) {
    return myFile.readAsString();
  });
);
</pre></p>
<p style="text-align:justify;">The call to <code>Schedule.bg</code> &#8220;simply&#8221; sends a task to a background thread and ensures that any result, error, etc. is routed back to the promise. The promised value itself is used exactly as in the previous example.</p>
<p style="text-align:justify;">Once again, we may compare to the XPConnect-based implementation;</p>
<ul style="text-align:justify;">
<li><code>OS.File</code>-based implementation of asynchronous reading takes 3 lines including opening, closing, resource management / general XPConnect-based implementation of asynchronous reading takes about 10-15 lines, although reading from a hard-coded path or a resource inside the Mozilla Platform can be reduced to 5-6 lines;</li>
<li><code>OS.File</code> implementation of background reading takes 5 lines / XPConnect does not expose sufficient features to permit permit background, although such features could certainly be implemented in C++ and exposed through XPConnect;</li>
<li><code>OS.File</code>-based implementation only works for files / XPConnect-based implementation works for just about any construction;</li>
<li>benchmarks are not available, but I have hope that the <code>OS.File</code> implementation should be faster than the XPConnect-based implementation due to a less generic implementation and a lower overhead;</li>
<li>the promises used in the <code>OS.File</code>-based implementation encourages writing code in natural order, in which the code that uses a value appears after the code that fetches the value / XPConnect-based implementation encourages backwards coding, in which the function that uses a value appears before the code that fetches the value (aka &#8220;asynchronous spaghetti programming&#8221;).</li>
</ul>
<h2 style="text-align:justify;"></h2>
<h2 style="text-align:justify;">API summary</h2>
<p style="text-align:justify;">The API defines the following constructors:</p>
<ul style="text-align:justify;">
<li><code>OS.File</code> – all operations upon an open file, including reading, writing, accessing or altering information, flushing, closing the file;</li>
<li><code>OS.Dir</code> – all operations upon an open directory, including listing its contents, walking through the directory, opening an item of the directory, removing an item of the directory;</li>
<li><code>OS.Path</code> – all operations on paths which do not involve opening a directory, including concatenation, climbing up and down the tree ;</li>
<li><code>OS.File.Error</code> – all file-system related errors.</li>
</ul>
<p style="text-align:justify;">and the following global objects:</p>
<ul style="text-align:justify;">
<li><code>OS.File</code> – opening a file, with or without auto-cleanup;</li>
<li><code>OS.Dir</code> – opening a directory;</li>
<li><code>OS.Path</code> – well-known directories and files.</li>
</ul>
<h3 style="text-align:justify;">Speed</h3>
<p style="text-align:justify;">Writing fast, cross-platform, file manipulation code is a complex task. Indeed, some platforms accelerate opening a file from a directory (e.g. Linux), while other platforms do not have such operations (e.g. MacOS, Windows). Some platforms let applications collect all information regarding a file with a single system call (Unix), while others spread the work through several system calls (Windows). The amount of information that may be obtained upon a file without having to perform additional system calls varies from OS to OS, as well as the maximal length of a path (e.g. under Windows, the value of <code>MAX_PATH</code> is false), etc.</p>
<p style="text-align:justify;">The design of OS.File takes this into account, as well as the experience from the previous generations of file manipulation APIs in the Mozilla Platform (<code>prfile</code> and <code>nsIFile</code>/<code>nsILocalFile</code>), and works hard to minimize the number of system calls required for each operation, and to let experts fine-tune their code for performance. While benchmarking is not available yet, we have good hope that this will make it possible to write IO code that runs much faster, in particular on platforms with slow file systems (e.g. Android).</p>
<p style="text-align:justify;">In addition, although this should have a much smaller impact, OS.File uses as bridge between C++ and JavaScript the JSAPI, which is, at the moment of this writing, the fastest C++-to-JavaScript bridge on the Mozilla Platform.</p>
<h3 style="text-align:justify;">Responsiveness</h3>
<p style="text-align:justify;">Speed is not sufficient to ensure responsiveness. For this purpose, long-running operations are provided with asynchronous variants that divide the work in smaller chunks to avoid freezing up the thread. The API does not enforce the use of these asynchronous variants, as experience shows that such a drastic choice is sometimes too constraining for progressive refactoring of synchronous code towards better asynchronicity.</p>
<p style="text-align:justify;">Every operation can be backgrounded thanks to the Schedule module. At the time of this writing, it is not possible to send a file from a thread to another one, but we have a pretty clear idea of how we can do this, so this should become possible at some point in the future.</p>
<h2 style="text-align:justify;">What now?</h2>
<p style="text-align:justify;">As mentioned, this is a work in progress. I am currently hard at work on building a complete prototype by the end of December, with the hope of landing something soon afterwards. I expect that benchmarking will continue after this stage to fine-tune some low-level choices and improve the API. If you wish to follow progress – or vote for this feature – we have a Bugzilla <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=563742">tracking bug</a> on the topic, and a whole host of subbugs.</p>
<p style="text-align:justify;">Note that this API will not replace <code>nsIFile</code>, although once it has landed, some of our JavaScript code will progressively from <code>nsIFile</code> to <code>OS.File</code>.</p>
<p style="text-align:justify;">If you have any feedback, now is a great time to send it. Would you use this API? Would you need certain specific or obscure feature that is currently missing in the Mozilla Platform or that risks being lost?</p>
<p style="text-align:justify;">In future posts, I will introduce further examples and detail some of the choices that we have made to ensure the best possible speed on all platforms.</p>
<p style="text-align:justify;">Stay tuned!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/975/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/975/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dutherenverseauborddelatable.wordpress.com/975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dutherenverseauborddelatable.wordpress.com/975/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dutherenverseauborddelatable.wordpress.com/975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dutherenverseauborddelatable.wordpress.com/975/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/975/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/975/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/975/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/975/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=975&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2011/12/06/introducing-javascript-native-file-management/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>Stages chez Mozilla Paris&#8230; ou ailleurs</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2011/11/19/stages-chez-mozilla-paris-ou-ailleurs/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2011/11/19/stages-chez-mozilla-paris-ou-ailleurs/#comments</comments>
		<pubDate>Sat, 19 Nov 2011 20:03:50 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[En français / In French]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[Stage]]></category>
		<category><![CDATA[chercheur]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[offre d'emploi]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[programmation]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[recherche]]></category>
		<category><![CDATA[science]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[stage]]></category>
		<category><![CDATA[static analysis]]></category>
		<category><![CDATA[université]]></category>
		<category><![CDATA[universités]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=966</guid>
		<description><![CDATA[edit Nous sommes pleins jusqu&#8217;à Juin. Nous ne pouvons plus prendre de stagiaires sur Paris dont les stages commencent avant Juin. Comme tous les ans, Mozilla propose des stages en informatique, orientés Développement, R&#38;D ou Recherche. Selon le sujet, le stage peut vous emmener à Paris, aux États-Unis, au Canada, en Chine&#8230; À propos de [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=966&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p align="JUSTIFY"><strong>edit</strong> Nous sommes pleins jusqu&#8217;à Juin. Nous ne pouvons plus prendre de stagiaires sur Paris dont les stages commencent avant Juin.</p>
<p align="JUSTIFY">Comme tous les ans, Mozilla propose des stages en informatique, orientés Développement, R&amp;D ou Recherche. Selon le sujet, le stage peut vous emmener à Paris, aux États-Unis, au Canada, en Chine&#8230;</p>
<h2 align="JUSTIFY">À propos de Mozilla</h2>
<p align="JUSTIFY">La <a href="http://www.mozilla.org">Fondation Mozilla</a> est une association à but non-lucratif, fondée pour encourager un Internet ouvert, innovant et participatif. Vous avez probablement entendu parler de <a href="http://getfirefox.com">Mozilla Firefox</a>, le navigateur open-source qui a réintroduit sur le web les standards ouverts et la sécurité, ou de <a href="http://getthunderbird.com">Mozilla Thunderbird</a>, le client de messagerie multi-plateforme, open-source et extensible. Les activités de Mozilla ne s&#8217;arrêtent pas à ces deux produits et se prolongent à de nombreux projets pour le présent et l&#8217;avenir, tels que :</p>
<ul>
<li>
<p align="JUSTIFY"><a href="https://wiki.mozilla.org/B2G">Boot-to-Gecko</a>, système d&#8217;exploitation totalement ouvert et construit par la communauté, pour les téléphones portables, tablettes et autres machines communicantes ;</p>
</li>
<li style="text-align:justify;"><a href="https://developer.mozilla.org/en/SpiderMonkey">SpiderMonkey</a>, une famille de Machines Virtuelles conçues pour l&#8217;analyse statique et dynamique, la compilation et l&#8217;exécution des langages web, en particulier JavaScript ;</li>
<li>
<p align="JUSTIFY"><a href="https://developer.mozilla.org/en/Dehydra">DeHydra</a> et <a href="https://developer.mozilla.org/en/JSHydra">JSHydra</a>, outils d&#8217;analyse statique pour les langages C++ et JavaScript ;</p>
</li>
<li>
<p align="JUSTIFY"><a href="http://www.rust-lang.org/">Rust</a>, un nouveau langage de programmation conçu pour le développement d&#8217;applications système parallèles sûres ;</p>
</li>
<li>
<p align="JUSTIFY"><a href="https://wiki.mozilla.org/WebAPI">WebAPI</a>, un ensemble d&#8217;outils qui permettent d&#8217;étendre les capacités des applications web au-delà de celles des applications traditionnelles, la sécurité et la confidentialité en plus ;</p>
</li>
<li>
<p align="JUSTIFY"><a href="https://developer.mozilla.org/en/Gecko">Gecko</a>, le moteur de rendu extensible et portable pour le HTML, le XML et les interfaces graphiques, qui a permis Firefox, Thunderbird et de nombreuses autres applications ;</p>
</li>
<li>
<p align="JUSTIFY"><a href="https://browserid.org/">BrowserID</a>, une technique innovante qui fournit aux utilisateurs et aux développeurs les outils cryptographiques pour assurer l&#8217;identification sur le web, sans compromettre la vie privée, la simplicité ou la sécurité ;</p>
</li>
<li>
<p align="JUSTIFY">les fonctionnalités <a href="https://services.mozilla.com/">Mozilla Services</a> de gestion d&#8217;identité par le Cloud ;</p>
</li>
<li>
<p align="JUSTIFY">et d&#8217;autres encore&#8230;</p>
</li>
</ul>
<h2>À propos de vous</h2>
<p>Mozilla proposes plusieurs stages dans ses installations à travers le monde sur de nombreux sujets.</p>
<p>Votre profil :</p>
<ul>
<li>vous voulez faire du web un endroit meilleur, sur lequel chacun peut naviguer et contribuer en toute sécurité, sans avoir à craindre pour sa sécurité ou sa vie privée ;</li>
<li>vous souhaitez prendre part à un projet utilisé par plus de 33% de la population du web ;</li>
<li>vous voulez que votre travail soit utile à tous et visible par tous ;</li>
<li>vous avez de fortes compétences en Algorithmique et en Informatique ;</li>
<li>vous avez de fortes compétences dans au moins l&#8217;un des domaines suivants :</li>
<ul>
<li>systèmes d&#8217;exploitation ;</li>
<li>réseaux ;</li>
<li>géométrie algorithmique ;</li>
<li>compilation ;</li>
<li>cryptographie ;</li>
<li>analyse statique ;</li>
<li>langages de programmation ;</li>
<li>extraire des informations pertinentes à partir de données exotiques ;</li>
<li>algorithmique distribuée ;</li>
<li>le web en tant que plate-forme ;</li>
<li>interactions avec les communautés du logiciel libre ;</li>
<li>toute autre compétence qui, à votre avis, pourrait nous servir.</li>
</ul>
<li>sur certains sujets, un excellent niveau d&#8217;Anglais peut être indispensable ;</li>
<li>les stages sont généralement prévus pour des étudiants M1 ou M2 mais si vous arrivez à nous impressionner par vos réalisations ou par vos connaissances, le diplôme n&#8217;est pas indispensable.</li>
</ul>
<p style="text-align:justify;" align="JUSTIFY">Si vous vous reconnaissez, nous vous invitons à nous contacter. En fonction du sujet, les stages peuvent vous emmener à Paris, Mountain View, San Francisco, Toronto, Taipei, ou d&#8217;autres lieux à travers le monde.</p>
<p align="JUSTIFY">Les meilleurs stagiaires peuvent espérer un contrat freelance, un CDI ou/et une bourse de doctorat.</p>
<h2>Pour nous contacter</h2>
<p>Pour toute question, contactez :</p>
<ul>
<li>pour tout ce qui concerne les stages chez Mozilla, Julie Deroche (à mozilla.com, jderoche) &#8211; Mozilla Mountain View, College Recruiting ;</li>
<li>pour les stages à Paris, David Rajchenbach-Teller (à mozilla.com, dteller) – Mozilla Paris, Développeur / Chercheur.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/966/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/966/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dutherenverseauborddelatable.wordpress.com/966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dutherenverseauborddelatable.wordpress.com/966/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dutherenverseauborddelatable.wordpress.com/966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dutherenverseauborddelatable.wordpress.com/966/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/966/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/966/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/966/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/966/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=966&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2011/11/19/stages-chez-mozilla-paris-ou-ailleurs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>JavaScript, this static language (part 1)</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2011/10/20/javascript-this-static-language-part-1/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2011/10/20/javascript-this-static-language-part-1/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 13:31:36 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OCaml]]></category>
		<category><![CDATA[Recherche / Research]]></category>
		<category><![CDATA[Sûreté / Security]]></category>
		<category><![CDATA[Société]]></category>
		<category><![CDATA[closure compiler]]></category>
		<category><![CDATA[eval]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[lambda-calculus]]></category>
		<category><![CDATA[ml]]></category>
		<category><![CDATA[safety]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[static analysis]]></category>
		<category><![CDATA[static typing]]></category>
		<category><![CDATA[type inference]]></category>
		<category><![CDATA[typing]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[web applications]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=957</guid>
		<description><![CDATA[tl;dr JavaScript is a dynamic language. However, by borrowing a few pages from static languages – and a few existing tools – we can considerable improve reliability and maintainability. « Writing one million lines of code of JavaScript is simply impossible » (source: speaker in a recent open-source conference) JavaScript is a dynamic language – [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=957&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 style="text-align:justify;">tl;dr</h2>
<p style="text-align:justify;">JavaScript is a dynamic language. However, by borrowing a few pages from static languages – and a few existing tools – we can considerable improve reliability and maintainability.</p>
<h2 style="text-align:justify;">« Writing one million lines of code of JavaScript is simply impossible »</h2>
<p style="text-align:right;">(source: speaker in a recent open-source conference)</p>
<p style="text-align:justify;">JavaScript is a dynamic language – a very dynamic one, in which programs can rewrite themselves, objects may lose or gain methods through side-effects on themselves on on their prototypes, and, more generally, nothing is fixed.</p>
<p style="text-align:justify;">And dynamic languages are fun. They make writing code simple and fast. They are vastly more suited to prototyping than static languages. Dynamism also makes it possible to write extremely powerful tools that can perform JIT translation from other syntaxes, add missing features to existing classes and functions and more generally fully customize the experience of the developer.</p>
<p style="text-align:justify;">Unfortunately, such dynamism comes with severe drawbacks. Safety-minded developers will tell you that, because of this dynamism, they simply cannot trust any snippet, as this snippet may behave in a manner that does not match its source code. They will conclude that you cannot write safe, or even modular, applications in JavaScript.</p>
<p style="text-align:justify;">Many engineering-minded developers will also tell you that they simply cannot work in JavaScript, and they will not have much difficulty finding examples of situations in which the use of a dynamic language in a complex project can, effectively, kill the project. If you do not believe them, consider a large codebase, and the (rather common) case of a large transversal refactoring, for instance to replace an obsolete API by a newer one. Do this in Java (or, even better, in a more modern mostly-static language such as OCaml, Haskell, F# or Scala), and you can use the compiler to automatically and immediately spot any place where the API has not been updated, and will spot a number of errors that you may have made with the refactoring. Even better, if the API was designed to be safe-by-design, the compiler will automatically spot even complex errors that you may have done during refactoring, including calling functions/methods in the wrong order, or ownership errors. Do the same in JavaScript and, while your code will be written faster, you should expect to be hunting bugs weeks or even months later.</p>
<p style="text-align:justify;">I know that the Python community has considerably suffered from such problems during version transitions. I am less familiar with the world of PHP, but I believe this is no accident that Facebook is progressively arming itself with PHP static analysis tools. I also believe that this is no accident that Google is now <a title="First look at Google Dart" href="http://dutherenverseauborddelatable.wordpress.com/2011/10/13/first-look-at-google-dart/" target="_blank">introducing a typed language as a candidate replacement for JavaScript</a>.</p>
<p style="text-align:justify;">That is because today is the turn of JavaScript, or if not today, surely tomorrow. I have seen applications consisting in hundreds of thousands of lines of JavaScript. And if just maintaining these applications is not difficult enough, the rapid release cycles of both  Mozilla and Chrome, mean that external and internal APIs are now changing every six weeks. This means breakage. And, more precisely, this means that we need new tools to help us predict breakages and help developers (both add-on developers and browser contributors) react before these breakages hit their users.</p>
<p style="text-align:justify;">So let&#8217;s do something about it. Let&#8217;s make <em>our</em> JavaScript a strongly, statically typed language!</p>
<p style="text-align:justify;">Or let&#8217;s do something a little smarter.</p>
<h2 style="text-align:justify;">JavaScript, with discipline</h2>
<p style="text-align:justify;">At this point, I would like to ask readers to please kindly stop preparing tar and feathers for me. I realize fully that JavaScript is a dynamic language and that turning it into a static language will certainly result in something quite disagreeable to use. Something that is verbose, has lost most of the power of JavaScript, and gained no safety guarantees.</p>
<p style="text-align:justify;">Trust me on this, there is a way to obtain the best of both worlds, without sacrificing anything. Before discussing the manner in which we can attain this, let us first set objectives that we can hope to achieve with a type-disciplined JavaScript.</p>
<h3 style="text-align:justify;">Finding errors</h3>
<p style="text-align:justify;">The main benefit of strong, static typing, is that it helps find errors.</p>
<ul>
<li style="text-align:justify;">Even the simplest analyses can find <em>all</em> syntax errors, <em>all</em> unbound variables, <em>all</em> variables bound several times and consequently almost all scoping errors, which can already save considerable time for developers. Such an analysis requires no human intervention from the developer besides, of course, fixing any error that has been thus detected. As a bonus, in most cases, the analysis can suggest fixes.</li>
<li style="text-align:justify;">Similarly trivial forms of analysis can also detect suspicious calls to break or continue, weird uses of <code>switch()</code>, suspicious calls to private fields of objects, as well as suspicious occurrences of <code>eval</code> – in my book, eval is always suspicious.</li>
<li style="text-align:justify;">Slightly more sophisticated analyses can find <em>most occurrences</em> of functions or methods invoked with the wrong number of arguments. Again, this is without human intervention. With type annotations/documentation, we can move from <em>most occurrences</em> to <em>all occurrences</em>.</li>
<li style="text-align:justify;">This same analysis, when applied to public APIs, can provide developers with more informations regarding how their code can be (mis)used.</li>
<li style="text-align:justify;">At the same level of complexity, analysis can find <em>most</em> erroneous access to fields/methods, suspicious array traversals, suspicious calls to iterators/generators, etc. Again, with type annotations/documentation, we can move from <em>most</em> to <em>all</em>.</li>
<li>Going a little further in complexity, analysis can find fragile uses of <code>this</code>, uncaught exceptions, etc.</li>
</ul>
<h3></h3>
<h3>Types as documentation</h3>
<p style="text-align:justify;">Public APIs must be documented. This is true in any language, no matter where it stands on the static/dynamic scale. In static languages, one may observe how documentation generation tools insert type information, either from annotations provided by the user (as in Java/JavaDoc) or from type information inferred by the compiler (as in OCaml/OCamlDoc). But look at the documentation of Python, Erlang or JavaScript libraries and you will find the exact same information, either clearly labelled or hidden somewhere in the prose: every single value/function/method comes with a form of type signature, whether formal or informal.</p>
<p style="text-align:justify;">In other words, type information is a critical piece of documentation. If JavaScript developers provide explicit type annotations along with their public APIs, they have simply advanced the documentation, not wasted time. Even better, if such type can be automatically inferred from the source code, this piece of documentation can be automatically written by the type-checker.</p>
<h3 style="text-align:justify;">Types as QA metric</h3>
<p style="text-align:justify;">While disciples of type-checking tend to consider typing as something boolean, the truth is more subtle: it quite possible that one piece of code does not pass type-checking while the rest of the code does. Indeed, with advanced type systems that do not support decidable type inference, this is only to be expected.</p>
<p style="text-align:justify;">The direct consequence is that type-checking can be seen as a spectrum of quality. A code can be seen as <em>failing</em> if the static checking phrase can detect evident errors, typically unbound values or out-of-scope break, continue, etc. Otherwise, every attempt to type a value that results in a type error is a hint of poor QA practice that can be reported to the developer. This yields a percentage of values that can be typed – obtain 100% and get a QA stamp of approval for this specific metric.</p>
<h2 style="text-align:justify;"></h2>
<h2>Typed JavaScript, in practice</h2>
<p style="text-align:justify;">Most of the previous paragraphs are already possible in practice, with existing tools. Indeed, I have personally experienced using JavaScript static type checking as a bug-finding tool and a QA metric. On the first day, this technique has helped me find both plenty of dead code and 750+ errors, with only a dozen false positives.</p>
<p style="text-align:justify;">For this purpose, I have used Google&#8217;s <a href="http://www.slideshare.net/pascallouis/type-checking-javascript" target="_blank">Closure Compiler</a>. This tool detects errors, supports a simple vocabulary for documentation/annotations, fails only if very clear errors are detected (typically syntax errors) and provides as metric a percentage of well-typed code. It does not accept JavaScript 1.7 yet, unfortunately, but this can certainly be added.</p>
<p style="text-align:justify;">I also know of existing academic work to provide static type-checking for JavaScript, although I am unsure as to the maturity of such works.</p>
<p>Finally, Mozilla is currently working on a different type inference mechanism for JavaScript. While this mechanism is not primarily aimed at finding errors, my personal intuition is that it may be possible to repurpose it.</p>
<h2></h2>
<h2>What&#8217;s next?</h2>
<p style="text-align:justify;">I hope that I have convinced you of the interest of investigating manners of introducing static, strong type-checking to JavaScript. In a second part, I will detail how and where I believe that this can be done in Mozilla.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/957/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/957/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/957/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/957/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dutherenverseauborddelatable.wordpress.com/957/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dutherenverseauborddelatable.wordpress.com/957/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dutherenverseauborddelatable.wordpress.com/957/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dutherenverseauborddelatable.wordpress.com/957/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/957/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/957/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/957/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/957/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/957/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/957/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=957&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2011/10/20/javascript-this-static-language-part-1/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>First look at Google Dart</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2011/10/13/first-look-at-google-dart/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2011/10/13/first-look-at-google-dart/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 16:23:02 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[OPA]]></category>
		<category><![CDATA[Sûreté / Security]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[applications]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[dart]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[vm]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=941</guid>
		<description><![CDATA[A few weeks ago, the browser and web development communities started wondering about this mysterious new web language that Google was about to unveil: Dart. Part of the interrogation was technical – what would that language look like? how would a new language justify its existence? what problems would it solve? – and part was [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=941&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;">A few weeks ago, the browser and web development communities started wondering about this mysterious new web language that Google was about to unveil: Dart. Part of the interrogation was technical – what would that language look like? how would a new language justify its existence? what problems would it solve? – and part was more strategic – what was Google doing preparing a web language in secret? where the leaked memos that seemed to imply a web-standards-breaking stance something that Google would indeed pursue? was Google trying to solve web-related problems, Google-related problems or Oracle-related problems?</p>
<p style="text-align:justify;">Now, Google has unveiled the specifications of Dart, as well as library documentation. Neither will be sufficient to answer all questions, but they give us an opportunity to look at some of the technical sides of the problem. As a programming language researcher/designer and a member of the web browser community, I just had to spend some quality time with the Dart specifications.</p>
<p>So, how&#8217;s Dart? Well, let&#8217;s look at it.</p>
<h2>What Dart is</h2>
<p style="text-align:justify;">Dart is a programming language and a Virtual Machine. As a programming language, Dart positions itself somewhere in the scope between scripting/web development and application development. From the world of application development, Dart brings</p>
<ul>
<li>clean concurrency primitives that would feel at home in Scala, Clojure or Erlang – including a level of concurrent error reporting;</li>
<li>a clean module mechanism, including a notion of privacy;</li>
<li>a type system offering genericity, interfaces and classes;</li>
<li>compilation and a virtual machine;</li>
<li>a library of data structures;</li>
<li>no eval();</li>
<li>data structures that do not change shape with time.</li>
</ul>
<p>From the world of scripting/web development, Dart brings:</p>
<ul>
<li style="text-align:justify;">usability in any standards-compliant browser, without any plug-in (although it will work better in a plug-in and/or in Chrome);</li>
<li>DOM access;</li>
<li>emphasis on fast start-up;</li>
<li>a liberal approach to typing (i.e. types are optional and the type system is incorrect, according to the specifications);</li>
<li>dynamic errors;</li>
<li style="text-align:justify;">closures (which are actually not scripting/web development related, but until Java 8 lands or until Scala, F# or Haskell gain popularity, most developers will believe that they are).</li>
</ul>
<h2>Where Dart might help</h2>
<p style="text-align:justify;">Web development has a number of big problems. I have <del>trolled</del> written about some of them in <a href="http://dutherenverseauborddelatable.wordpress.com/2011/04/18/rant-web-development-is-just-broken/">previous posts</a>, and Dart was definitely designed to help, at least a little.</p>
<h3>Security</h3>
<p style="text-align:justify;">JavaScript is interpreted, can be written inline in html and supports eval(). By opposition, Dart code is compiled. Dart does not have eval() and Dart code is not written inline in html. Consequently, Dart itself offers a smaller attack surface for cross-site scripting.  Note that Dart can still be used as a component for a XSS targeting the document itself, and that using Dart does not prevent an attacker from using JavaScript to inject XSS in the page.</p>
<h3>Safety and Code Hygiene</h3>
<p style="text-align:justify;">Out-of-the-box, JavaScript does not offer any static or hybrid typing. Dart offers (optional, hybrid) typing. This is a very useful tool for helping developers and developer groups find errors in their code quickly.</p>
<p style="text-align:justify;">JavaScript offers prototype-based object-oriented programming, without explicit private methods/fields. By opposition, Dart offers modules, classes (with support for private methods/fields) and interfaces. Again, very useful for providing abstractions that do not leak [too much].</p>
<p style="text-align:justify;">For historical reasons, JavaScript offers weird and error-prone scoping and will let developers get away without realizing that they are dereferencing undefined variables. Dart does away with this. Again, this is a good way to find errors quickly.</p>
<h3>Libraries</h3>
<p style="text-align:justify;">Out-of-the-box, JavaScript does not provide data structures, or much in the way of libraries. By opposition, Dart provides a few data structures and libraries.</p>
<h3>Exceptions</h3>
<p style="text-align:justify;">For a long time, JavaScript exceptions were not extensible. Eventually, it became possible to define new kinds of exceptions. However, JavaScript still doesn&#8217;t support matching the exception constructor, by opposition to what almost all other programming languages do. Dart makes no exception and allows matching upon the exception constructor. This makes exception-handling a little nicer and debugging exception traces a little more robust.</p>
<h3>Concurrency</h3>
<p style="text-align:justify;">For a long time, JavaScript did not provide any form of concurrency primitive. Recent versions of JavaScript do offer Workers. Similarly, Dart offers Isolates, with a paradigm very similar to Workers. Where Workers are always concurrent, Isolates can also be made non-concurrent, for better performance at the expense of reactivity. Initialization and error-reporting are also a little different, but otherwise, Isolates and Workers are quite comparable.</p>
<h3>Speed</h3>
<p style="text-align:justify;">Dart promises better speed than JavaScript. I cannot judge about it.</p>
<h3>Niceties</h3>
<p style="text-align:justify;">Dart offers &#8220;string interpolation&#8221; to insert a value in a string. Nice but not life-altering. Also, out-of-the-box, JavaScript DOM access is quite verbose. By opposition, Dart provides syntactic sugar that makes it a little nicer.</p>
<h2>Where Dart might hinder</h2>
<h3>Vendor control/adoption</h3>
<p style="text-align:justify;">The single biggest problem with Dart is, of course, its source. To get the VM in the browsers, Google will have to convince both developers and other browser vendors to either reimplement the VM by themselves or use a Google-issued VM. This is possible, but this will be difficult for Google.</p>
<p style="text-align:justify;">The open vehicle for this is to convince developers to us Dart for server-side programming – where Dart will be competing with Java, Scala, C#, F#, Python, JavaScript, Erlang and even Google&#8217;s Go – and for client-side programming by getting through JavaScript – which will severely hinder performance, safety and security.</p>
<p style="text-align:justify;">The vendor controlled vehicle will be to integrate the VM in Chrome and Android and encourage developers targeting the Chrome Market and Android Market to use Dart. Some speculate that this is a manner for Google to get rid of the Java dependency on the Android Market. In this case, of course, there will be little competition.</p>
<h3 style="text-align:justify;">Libraries and documentation</h3>
<p style="text-align:justify;">JavaScript has a host of libraries and considerable documentation. I will admit that much of the documentation one may find around the web is not good (hint: use <a href="https://developer.mozilla.org/en/JavaScript">Mozilla&#8217;s documentation</a>, it is the only reliable source I have found), but that is still infinitely more than what Dart can provide at the moment.</p>
<p style="text-align:justify;">In other words, for the moment, Dart cannot take advantage of the special effects, the game-building libraries, the streaming libraries, etc. that have been developed for JavaScript. This, of course, is something that Google has the resources to change relatively fast, but, by experience, I can tell that many developers are averse to relearning.</p>
<h2>Doing it without Dart</h2>
<h3>Security</h3>
<p style="text-align:justify;">We&#8217;re not going to get rid of XSS <a href="http://dutherenverseauborddelatable.wordpress.com/category/informatique-computer-science/opa/">without some effort</a>, even with Dart. However, making sure that JavaScript offers an attack surface no larger than Dart is easy: forbid eval() and forbid any inline JavaScript. It would be quite easy to add an option to HTML documents to ensure that this is the case. Note that this option remains necessary even if all the code is written in Dart, as Dart does not prevent from injecting JavaScript.</p>
<h3 style="text-align:justify;">Code Hygiene</h3>
<p style="text-align:justify;">Out-of-the-box, JavaScript does not offer any support for static/hybrid typing. However, Google has demonstrated how to add static typing with the <a href="http://code.google.com/closure/compiler/docs/js-for-compiler.html">Google Closure Compiler</a> and Mozilla has demonstrated how to add hybrid typing with <a href="http://www.extremetech.com/computing/94532-firefox-9-javascript-performance-improved-by-20-30-with-type-inference">Dynamic Type Inference</a>. Both projects indicate that we can obtain something at least as good as Dart in JavaScript, without altering/reinventing the language.</p>
<p style="text-align:justify;">Out-of-the-box, JavaScript does not offer modules. However, Mozilla has been offering a module system for JavaScript for years and new versions of the language are in the process of standardizing this.</p>
<p style="text-align:justify;">Also, while classes and private fields are probably the least surprising techniques for application developers coming to the web, developers used to dynamic or functional languages know that closures and prototypes are essentially equivalent. So, this is essentially a matter of taste.</p>
<p style="text-align:justify;">Finally, clean, lexical scoping will be welcomed by all developers who know what these words mean and quite a few others. Fortunately, it is also coming to JavaScript with recent versions of the language.</p>
<h3 style="text-align:justify;">Concurrency</h3>
<p style="text-align:justify;">Isolates are nice. Workers are nice. Isolates are a little easier to set-up, so I would like to see an Isolate-like API for Workers. Other than that, they are essentially equivalent.</p>
<h3 style="text-align:justify;">Speed</h3>
<p style="text-align:justify;">So far, Google has always managed to deliver on speed promises with V8, so I would tend to believe them. However, recent improvements in JavaScript analysis also promise to analyze away all the cases that can make JavaScript slower than Java, and I also tend to believe these promises. Consequently, I will venture no guess about it.</p>
<h3>Libraries</h3>
<p style="text-align:justify;">It is a shame that JavaScript does not come with more libraries. However, many frameworks are available that implement standard data structures and more.</p>
<h3>Exceptions</h3>
<p style="text-align:justify;">Dart exceptions are a little nicer than JavaScript exceptions, there no doubt about that. However, making JavaScript exceptions as good as Dart exceptions would be quite simple. The only difficulty is getting this improvement into the standard.</p>
<h3>Niceties</h3>
<p style="text-align:justify;">String interpolations are nice to have, but not really life-altering. If necessary, they can trivially be implemented by a pre-processor. CoffeeScript might already do it, I&#8217;m not sure. Adding this to the JS standard might be tricky, for reasons of backwards compatibility, but there is not much to it.</p>
<p style="text-align:justify;">Dart-style DOM access is nice, too. However, adding this to JavaScript would be quite trivial, in particular with next-generation DOM implementations such as dom.js.</p>
<h2>The result</h2>
<p style="text-align:justify;">I admit that I am a little disappointed. When Dart was announced, I was hoping something truly evolutionary. So far, what I have found out is a nice language, certainly, but not much more. While Dart is definitely better in many aspects than today&#8217;s JavaScript, given the current evolution of JavaScript, none of these aspects is a deal-breaker. However, several aspects of Dart (in particular, typing and exceptions) indicate a good direction in which I believe JavaScript should evolve, and I hope that the presence of Dart can get JavaScript standardization moving faster.</p>
<p style="text-align:justify;">If we consider I my opinion, there are three ways that Google can get Dart adopted on the web:</p>
<ul>
<li>make it the default choice for Android &amp; Chrome development;</li>
<li>provide a set of killer libraries for the web, that work on all browsers but are truly usable only with Dart (DirectX anyone? something Cocoa-style, perhaps?);</li>
<li>spend Google-sized budgets on adoption (PR, marketing, GSoC, open-source projects, etc.).</li>
</ul>
<p style="text-align:justify;">
<p style="text-align:justify;">Nevertheless, for the moment, I will keep far away from Dart and look hopefully at <a href="http://scalagwt.github.com/">Scala-GWT</a>, <a href="http://www.websharper.com/">WebSharper</a> or <a href="http://ocsigen.org">Ocsigen</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/941/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/941/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/941/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/941/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dutherenverseauborddelatable.wordpress.com/941/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dutherenverseauborddelatable.wordpress.com/941/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dutherenverseauborddelatable.wordpress.com/941/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dutherenverseauborddelatable.wordpress.com/941/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/941/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/941/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/941/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/941/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/941/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/941/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=941&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2011/10/13/first-look-at-google-dart/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
		<item>
		<title>Helping Bugzilla Help Newcomers Help Mozilla Help Users</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2011/10/13/helping-bugzilla-help-newcomers-help-mozilla-help-users/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2011/10/13/helping-bugzilla-help-newcomers-help-mozilla-help-users/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 10:05:59 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[badge]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[bugzilla]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[contribution]]></category>
		<category><![CDATA[contributor]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[help]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[mozilla-central]]></category>
		<category><![CDATA[newbie]]></category>
		<category><![CDATA[old-timer]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[pull request]]></category>
		<category><![CDATA[push]]></category>
		<category><![CDATA[triage]]></category>
		<category><![CDATA[wiki]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=942</guid>
		<description><![CDATA[tl;dr We can make Bugzilla more newbie-friendly. edit Thanks for pointing me to mentored bugs, Josh! The context Earlier today, a discussion got me thinking about how we can lower the entry barriers for people who want to contribute to Mozilla in a technical or semi-technical way but do not know where to start – [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=942&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 style="text-align:justify;">tl;dr</h2>
<p style="text-align:justify;">We can make Bugzilla more newbie-friendly.</p>
<p style="text-align:justify;"><strong>edit</strong> Thanks for pointing me to mentored bugs, Josh!</p>
<h2 style="text-align:justify;">The context</h2>
<p style="text-align:justify;">Earlier today, a discussion got me thinking about how we can lower the entry barriers for people who want to contribute to Mozilla in a technical or semi-technical way but do not know where to start – by &#8220;technical or semi-technical&#8221;, I have in mind developers, web developers, translators, and more generally people who need to commit some form of patch to any of the Mozilla subprojects.</p>
<p style="text-align:justify;">There are many things that we can improve, but for this post, I would like to concentrate on Bugzilla tweaks that I believe could be useful. These tweaks come from a simple remark: for all contributors Bugzilla is, in fact, a form of <em>contribution console</em>. Unfortunately, for the moment, I see the following problems:</p>
<ul>
<li>Bugzilla doesn&#8217;t help newcomers find easy entry points;</li>
<li>Bugzilla doesn&#8217;t guide newcomers towards their first patch;</li>
<li>Bugzilla doesn&#8217;t help old-timers help newcomers.</li>
</ul>
<p>So, let&#8217;s see how we could improve Bugzilla.</p>
<h2>Making newcomers visible and encouraging old-timers to help them</h2>
<p style="text-align:justify;">I believe that the first thing we need to do is to make sure that <em>newbies are more visible to old-timers</em>. For this purpose, we can provide an account attribute &#8220;I&#8217;m a beginner, please be gentle&#8221;, which appears in the profile, ticked by default, and remains there until unticked. Every message, attachment or patch provided by a newbie is clearly labelled as such.</p>
<p>This label may come with a link to the wiki with suggestions for old-timers wanting to help the newbie.</p>
<p style="text-align:justify;">Similarly, we can encourage old-timers to <em>adopt a newbie</em>. For this purpose, we can provide an account attribute &#8220;Adopt a newbie&#8221;, with a list of accounts. Every message, attachment or patch provided by an adopted newbie is automatically tracked by the adopter.</p>
<p><strong>Note</strong> As far as I understand, these features are already essentially implemented. I&#8217;m just proposing a small tweak.</p>
<h2>Having Bugzilla tell stories</h2>
<p style="text-align:justify;">Bugzilla is a nice place for reporting bugs and discussing how to solve it. I propose a simple tweak to make Bugzilla <em>tell the story of a patch</em>. Let me show you one possible manner of doing this:</p>
<p><a href="http://dutherenverseauborddelatable.files.wordpress.com/2011/10/changes-1.png"><img class="aligncenter size-full wp-image-943" title="Telling a story in Bugzilla" src="http://dutherenverseauborddelatable.files.wordpress.com/2011/10/changes-1.png?w=480" alt=""   /></a></p>
<p>Each of these link should help a newcomer on one step towards getting a patch submitted and accepted:</p>
<ol>
<li style="text-align:justify;">&#8220;Help me set up for contributing&#8221; points to some of the wiki pages we already have containing project-specific setup documentation. For Mozilla coding bugs, this explains how to build Mozilla. For localization bug, this explains how to setup whichever tools are required, etc. This is set up on a per-component basis.</li>
<li style="text-align:justify;">&#8220;Help me contact the developers&#8221; points to the component-specific wiki page with all the contact information (IRC channel, forum, mailing-list, module owner e-mail address, etc.).</li>
<li style="text-align:justify;">&#8220;Help me find project doc&#8221; points to the project-specific wiki page with all the documentation.</li>
<li style="text-align:justify;">&#8220;Help me submit a contribution&#8221; points to a beginner-oriented wiki page with the information on submitting. For mozilla-central, for instance, beginners should be able to find the two lines that will let them export everything they have done as one hg patch.</li>
<li style="text-align:justify;">&#8220;What&#8217;s next&#8221; points to a wiki page detailing the submission approval process, the various forums, IRC channels, etc. to which the contributor can participate.</li>
</ol>
<p>This is for beginners. As you may have seen, there is another toolbar, designed for experienced developers/community members:</p>
<p><a href="http://dutherenverseauborddelatable.files.wordpress.com/2011/10/change-4.png"><img class="aligncenter size-full wp-image-946" title="Community pending tasks" src="http://dutherenverseauborddelatable.files.wordpress.com/2011/10/change-4.png?w=480" alt=""   /></a></p>
<p>This toolbar is designed to keep track of activity on bugs that the user follows:</p>
<ol>
<li>&#8220;Unconfirmed&#8221; lists the number of UNCO bugs followed by the user.</li>
<li>&#8220;In progress&#8221; lists the number of NEW bugs followed by the user.</li>
<li>&#8220;Review&#8221; lists the number of patches pending review in bugs followed by the user.</li>
<li>&#8220;Mentoring&#8221; lists the unread messages and patches submitted by newbies adopted by the user.</li>
</ol>
<p>Clicking on each link points to a bugzilla search of the corresponding bugs.</p>
<h2></h2>
<h2>Making easy bugs easy to discover</h2>
<p style="text-align:justify;">New contributors need to find good entry points. For this purpose, we have project-specific lists of good first bugs. However, at the moment, the lists I could find are both hard to discover and unmaintained. So, let&#8217;s integrate this in Bugzilla. As it turns out, it&#8217;s <del>quite easy</del><a href="http://www.joshmatthews.net/blog/2011/09/making-bugs-more-attractive-for-other-people-to-fix/">done already</a> (and better than what I suggested initially).</p>
<p style="text-align:justify;"><del>I suggest adding two tags: &#8220;easy&#8221; and &#8220;average&#8221;. Every bug can be annotated as &#8220;easy&#8221; if a developer believes that it&#8217;s a good first bug or &#8220;average&#8221; if a developer believes that it&#8217;s a bug that requires some experience but no architectural overview.</del></p>
<p style="text-align:justify;">Once this is done, we can link from all our wikis and contributor engagement pages to Bugzilla searches with all the &#8220;easy&#8221; and all the &#8220;average&#8221; bugs, both project-wide and by component.</p>
<h2>Submission add-on</h2>
<p>This one is more of a dream. I believe that, at some point, we could develop an add-on that can be installed directly fro the Bugzilla toolbar, and whose role is to provide a wizard to help users:</p>
<ul>
<li>install the appropriate source management tool;</li>
<li>once the tool is installed, submit a patch for review.</li>
</ul>
<p style="text-align:justify;">Initially, this add-on covers only mozilla-central. Later, upgrades to this add-on and/or project-specific add-ons may be added for projects not covered by mozilla-central (typically projects hosted on github).</p>
<p>Inspiration: want to do better than (otherwise excellent) github &#8220;pull request&#8221; <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Badges!</h2>
<ul>
<li>First bug report tagged &#8220;new&#8221;? Earn a badge!</li>
<li>First patch submitted? Earn a badge!</li>
<li>First patch accepted? Earn a badge!</li>
<li>Same thing for the marks of 10, 50, 100 &#8230;</li>
</ul>
<h2>Any thoughts?</h2>
<p>Ok, this lists the tweaks that I can think of to improve newbie experience with contributions. What do you think? Any way we can make this better?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dutherenverseauborddelatable.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dutherenverseauborddelatable.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dutherenverseauborddelatable.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dutherenverseauborddelatable.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/942/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/942/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/942/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=942&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2011/10/13/helping-bugzilla-help-newcomers-help-mozilla-help-users/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>

		<media:content url="http://dutherenverseauborddelatable.files.wordpress.com/2011/10/changes-1.png" medium="image">
			<media:title type="html">Telling a story in Bugzilla</media:title>
		</media:content>

		<media:content url="http://dutherenverseauborddelatable.files.wordpress.com/2011/10/change-4.png" medium="image">
			<media:title type="html">Community pending tasks</media:title>
		</media:content>
	</item>
		<item>
		<title>Good morning Mozilla!</title>
		<link>http://dutherenverseauborddelatable.wordpress.com/2011/09/21/good-morning-mozilla/</link>
		<comments>http://dutherenverseauborddelatable.wordpress.com/2011/09/21/good-morning-mozilla/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 14:36:16 +0000</pubDate>
		<dc:creator>yoric</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[In English / En anglais]]></category>
		<category><![CDATA[Informatique / Computer science]]></category>
		<category><![CDATA[Sûreté / Security]]></category>
		<category><![CDATA[mlstate]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://dutherenverseauborddelatable.wordpress.com/?p=933</guid>
		<description><![CDATA[It&#8217;s an exciting time for us Computer Scientists. Three years ago, I was an academic researcher, studying the best manner to certify binaries uploaded to clouds and ensure their security. Less than three weeks ago, I was working at MLstate, leading the R&#38;D team and striving to change the face of web programming languages and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=933&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s an exciting time for us Computer Scientists.</p>
<p style="text-align:justify;">Three years ago, I was an academic researcher, studying the best manner to certify binaries uploaded to clouds and ensure their security. Less than three weeks ago, I was working at MLstate, leading the R&amp;D team and striving to change the face of web programming languages and web security. Today, I am part of Mozilla, as a proud member of the Performance team, where we take steps, each day, to make Firefox, Thunderbird and the Mozilla platform faster and more responsive.</p>
<p style="text-align:justify;">We, at Mozilla, have considerable work ahead of us. Because the web needs to be defended, kept open and compatible with privacy, and, on some of these fronts, only Mozilla stands.</p>
<p style="text-align:justify;">An exciting time, indeed – and an exciting way of doing my part!</p>
<p style="text-align:justify;">I will try and blog about ongoing developments as soon as I find a minute.</p>
<p style="text-align:justify;"><strong>Edit</strong> It seems that I misredacted some of the announces that were sent. Just to clarify, I am <strong>not</strong> the leader of the Performance team. That person is <a href="http://blog.mozilla.com/tglek/">Taras Glek</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dutherenverseauborddelatable.wordpress.com/933/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dutherenverseauborddelatable.wordpress.com/933/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dutherenverseauborddelatable.wordpress.com/933/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dutherenverseauborddelatable.wordpress.com/933/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dutherenverseauborddelatable.wordpress.com/933/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dutherenverseauborddelatable.wordpress.com/933/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dutherenverseauborddelatable.wordpress.com/933/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dutherenverseauborddelatable.wordpress.com/933/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dutherenverseauborddelatable.wordpress.com/933/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dutherenverseauborddelatable.wordpress.com/933/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dutherenverseauborddelatable.wordpress.com/933/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dutherenverseauborddelatable.wordpress.com/933/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dutherenverseauborddelatable.wordpress.com/933/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dutherenverseauborddelatable.wordpress.com/933/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dutherenverseauborddelatable.wordpress.com&amp;blog=1202429&amp;post=933&amp;subd=dutherenverseauborddelatable&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dutherenverseauborddelatable.wordpress.com/2011/09/21/good-morning-mozilla/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/26385ab59b5a13c50262c302a3bcd17c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">yoric</media:title>
		</media:content>
	</item>
	</channel>
</rss>
