<?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/"
	>

<channel>
	<title>All Night Diner &#187; hindsight</title>
	<atom:link href="http://micropipes.com/blog/tag/hindsight/feed/" rel="self" type="application/rss+xml" />
	<link>http://micropipes.com/blog</link>
	<description>because at 3am anything sounds good</description>
	<lastBuildDate>Mon, 03 May 2010 17:34:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AMO Development Changes in 2010</title>
		<link>http://micropipes.com/blog/2009/11/17/amo-development-changes-in-2010/</link>
		<comments>http://micropipes.com/blog/2009/11/17/amo-development-changes-in-2010/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 21:44:12 +0000</pubDate>
		<dc:creator>Wil Clouser</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[AMO]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[hindsight]]></category>
		<category><![CDATA[L10n]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[scalability]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://micropipes.com/blog/?p=98</guid>
		<description><![CDATA[The AMO team met in Mountain View last week to develop a 2010 plan.  We&#8217;ve been wanting to change some key areas of our development flow for a while but we needed to make sure time was budgeted in the overall AMO and Mozilla goals.  As usual, the timeline will be tight, but [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="https://addons.mozilla.org/"><abbr title="addons.mozilla.org">AMO</abbr></a> team met in Mountain View last week to develop a 2010 plan.  We&#8217;ve been wanting to change some key areas of our development flow for a while but we needed to make sure time was budgeted in the overall AMO and Mozilla goals.  As usual, the timeline will be tight, but the AMO developers do amazing work and as our changes are implemented, development should just get faster.  I&#8217;ll give a brief summary of the changes we&#8217;re planning; a lot of discussion went into this and I&#8217;m not going to be able to cover everything here.  If you&#8217;ve been in the AMO calls or reading the notes you probably already know most of this.</p>
<h3>Migrating from CakePHP to Django</h3>
<p>This is a big undertaking and we&#8217;ve been discussing it for quite a while.  We&#8217;re currently the highest trafficked site on the internet using <a href="http://cakephp.org/">CakePHP</a> and along with that we&#8217;ve run into a lot of frustrating issues.  CakePHP has serviced AMO well for several years, so it&#8217;s not my intention to bad mouth it here, but I do want to give a fair summary of why we&#8217;re moving on.  Please also note that <em>AMO is still running on CakePHP 1.1 which is, I think, a year out of date</em>?  Three substantial issues:</p>
<ul>
<li><strong>Useful Database Abstraction Layer:</strong>  CakePHP has a concept of database abstraction, but we didn&#8217;t find it powerful enough.  When it did work it would return enormous nested arrays of data causing massive CPU and memory usage (out of memory errors plague us on AMO).  When it didn&#8217;t work, we&#8217;d end up doing queries directly which kind of defeats the purpose.  We couldn&#8217;t use prepared statements so we&#8217;d have to escape variables ourselves.  There was no effective caching built-in and since we just had huge arrays as a response there was no effective way to invalidate the cache we were using (see: <a href="http://micropipes.com/blog/2008/04/23/caching-is-easy-expiration-is-hard/">Caching is easy; Expiration is hard</a>).  The DB layer should return objects that are easy to cache and easy to invalidate.  The built-in Django database classes (combined with memcache) should work fine for us here.</li>
<li><strong>Effective unit tests:</strong>  I&#8217;ve <a href="http://micropipes.com/blog/2009/04/09/addonsmozillaorg-celebrates-1000-passing-unit-tests/">beat the drum about our unit tests before</a> but the simple matter is that it&#8217;s really difficult to do them right with the tools we are using.  Our test data is already very limited, but if we try to run all our tests right now they&#8217;ll run out of memory (and take forever).  The CakePHP method of mocking controllers and models was inadequate for what we needed and difficult to deal with.  We want our unit tests to run quickly, from the command line, and be independent from each other so there aren&#8217;t intermittent problems to waste our time with.  We&#8217;ll be using Django&#8217;s <a href="http://docs.djangoproject.com/en/dev/topics/testing/">built-in testing framework</a>.</li>
<li><strong>Better debugging:</strong>  Debugging in CakePHP amounts to defining a DEBUG level and seeing what is printed on the screen (usually the giant arrays).  We supplemented this with <a href="http://www.xdebug.org/">Xdebug</a> where we needed it, but that&#8217;s still not enough.  A framework should have excellent logging and on-the-fly debugging that displays a full traceback (often something will fail deep within CakePHP and we&#8217;ll get the file/line where PHP gave up, but not the line in our code that started the problem), the values of variables, the page headers, server settings, SQL that was run, what views and elements are in use, etc.  We&#8217;re planning on using a combination of <a href="http://docs.python.org/library/pdb.html">pdb</a>, <a href="http://ipython.scipy.org/moin/">IPython</a>, and the <a href="http://robhudson.github.com/django-debug-toolbar/">django-debug-toolbar</a> to make all of this easily accessible while developing.</li>
</ul>
<p>Those are the major issues we&#8217;re having right now, but if you want to dig into the comparison some more check out our <a href="https://wiki.mozilla.org/AMO:v4">discussion wiki pages</a>, but realize the majority of discussion happened in person.</p>
<h3>Moving away from <abbr title="Subversion">SVN</abbr></h3>
<p>We moved AMO into SVN in 2006 and it&#8217;s treated us relatively well.  Somewhere along the line, we decided to tag our production versions at a revision of trunk instead of keeping a separate tag and merging changes into it.  It&#8217;s worked for us but it&#8217;s a hard cutoff on code changes, which means that while we&#8217;re in a code freeze no one can check anything in to trunk.  As we begin to branch for larger projects this will become more of a hassle, so I&#8217;m planning on going back to a system where a production tag is created and changes are merged into it as they are ready to go live.</p>
<p>Most of the development team has been using <a href="http://kernel.org/pub/software/scm/git/docs/git-svn.html">git-svn</a> for several months and, aside from the commands being far more verbose, we haven&#8217;t had many complaints.  We&#8217;ve discovered <a href="http://git-scm.com/">Git</a> is a much more powerful development tool and we expect to use it directly starting some time next year.  As of now, we expect to maintain the /locales/ directory in SVN so this change doesn&#8217;t affect localizers but we&#8217;ll keep people notified if there are any changes to that process.</p>
<h3>Continuous Integration</h3>
<p>I mentioned excellent testing being one of the reasons we&#8217;re moving to Django.  Along with that testing is the opportunity for continuous integration.  We plan on using <a href="https://hudson.dev.java.net/">Hudson</a> as the framework for our continuous integration.  With excellent test coverage and quick feedback from Hudson this should drastically lower our regressions and boost our confidence when we deploy.  Speaking of which&#8230;</p>
<h3>Faster Deployment</h3>
<p>For most of 2009 we&#8217;ve pushed on 3 week cycles.  2 weeks of development, 1 week of <abbr title="Quality Assurance">QA</abbr> and <abbr title="Localization">L10n</abbr>.  Delays and regressions being what they are, I think we averaged a little better than a push a month.  This is a fairly rapid cycle for a lot of development shops, but I feel like it&#8217;s holding us back.  We&#8217;ve heard a lot of success stories about shorter  cycles and I&#8217;d like to aim for deployment (optionally, of course) of a few times per week.  By shortening the development cycle we reduce the stress of:</p>
<ul>
<li><strong>the developers:</strong>  Everyone likes to see what they&#8217;ve done go out quicker and it means less conflicts with others when the patches are smaller.</li>
<li><strong>the QA team:</strong> Right now we dump 2 weeks of work on them and say we need it done right away.  With smaller cycles they can verify small changes as they go and not be overwhelmed.</li>
<li><strong>the infrastructure team:</strong> Smaller changes means less to go wrong and with a continuous integration server and some automation they can have minimal involvement with the whole process.</li>
<li><strong>the localizers:</strong> Every time we release we dump a bunch of changes on these fantastic people and tell them we need them back in a week.  Most of the time they plow forward and get them done on time.  If they don&#8217;t though, they are stuck with waiting for the next 3 week cycle.  If we push often, it&#8217;s not a big deal.</li>
<li><strong>the product managers:</strong> These guys come up with crazy ideas for us to implement and then they stare at graphs and numbers to see if it worked.  With shorter cycles they can get faster feedback about what works and what doesn&#8217;t.</li>
<li><strong>the users:</strong> Faster release cycles means bugs that are fixed in the repository are fixed on the live site sooner.  &#8217;nuff said.</li>
</ul>
<h3>Process Data Offline</h3>
<p>Much of AMO relies on cron jobs to get things done.  All the statistics, add-on download numbers, how popular an add-on is, all the star rating calculations, any cleanup or maintenance tasks &#8211; these are all run via cron and they are so intensive that the database has trouble keeping up.  We&#8217;re planning on utilizing <a href="http://gearman.org/">Gearman</a> to farm all this work out to other machines in incremental pieces instead of single huge queries.  Any heavy calculating that can be done offline will be moved to these external processors which should help improve the speed of the site and make all our statistics more reliable (as currently the cron jobs have a tendency to fail before they are complete).</p>
<h3>Improve the Documentation</h3>
<p>Documentation is a noble goal of many developers but it rarely gets enough attention.  We evaluated our <a href="https://wiki.mozilla.org/AMO:Developers">current documentation</a> and found it is woefully out of date.  By being on a wiki that is rarely used it doesn&#8217;t get updated except when someone tries to use it and sees it&#8217;s not right.  We&#8217;re hoping to change that by moving the developer documentation into the code repository itself.  We&#8217;ll be able to integrate with generated API docs, style the docs however we want, and check in changes right along with our code patches.  When someone checks out a copy of AMO, they&#8217;ll get all the documentation right along with it.  We&#8217;ll use <a href="http://sphinx.pocoo.org/">Sphinx</a> to build the docs.</p>
<p>The outline above details several large, high-level changes but there are a lot of other plans for smaller improvements as well.  This post got a lot longer than I was expecting, but I&#8217;m really excited about the direction AMO is headed for 2010.  As these changes are implemented the site will become more responsive and reliable, and we&#8217;ll be able to adapt to the needs of Mozilla&#8217;s users even faster.  As always, feedback and discussion are welcome and stay tuned for further back end improvements.</p>
]]></content:encoded>
			<wfw:commentRss>http://micropipes.com/blog/2009/11/17/amo-development-changes-in-2010/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Using substitution strings in .po files</title>
		<link>http://micropipes.com/blog/2009/09/01/using-substitution-strings-in-po-files/</link>
		<comments>http://micropipes.com/blog/2009/09/01/using-substitution-strings-in-po-files/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 20:08:00 +0000</pubDate>
		<dc:creator>Wil Clouser</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[AMO]]></category>
		<category><![CDATA[hindsight]]></category>
		<category><![CDATA[L10n]]></category>

		<guid isPermaLink="false">http://micropipes.com/blog/?p=82</guid>
		<description><![CDATA[A couple years ago I recommended using fake msgid&#8217;s in .po files and was, predictably, met with some argument.   I suggested using this hack because there wasn&#8217;t a standard way to store context in a .po file yet.[1]
Since that time msgctxt has become a standard part of gettext and makes my substitution string [...]]]></description>
			<content:encoded><![CDATA[<p>A couple years ago <a href="http://micropipes.com/blog/2007/07/26/ten-tips-for-website-localization/">I recommended using fake msgid&#8217;s in .po files</a> and was, predictably, met with some argument.   I suggested using this hack because there wasn&#8217;t a standard way to store context in a .po file yet.[1]</p>
<p>Since that time <em>msgctxt</em> has become a standard part of gettext and makes my substitution string recommendation obsolete.  I wanted to officially come out and say: substitution strings are a pain.  The scripts we used made it manageable but finding strings in the code meant searching through the .po and not only was this painful for our developers but I think it confused contributors as well.</p>
<p>In our latest release, we&#8217;ve converted <a href="https://addons.mozilla.org/">AMO</a> to use regular .po files now.  On the off chance someone followed my advice and would like to convert their site to regular .po files as well,  Zbigniew Braniecki <a href="http://diary.braniecki.net/2009/08/19/amo-loses-accent/">wrote a bit about the process</a> and you can grab his scripts (and read about the troubles I had) at <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=501988">bug 501988</a>.</p>
<p>Since I tagged this post <em>hindsight</em> I guess I should look back and conclude something too.  Would I do it again?  At the time, there were no great alternatives.  So, yeah, I would get more opinions on whether the Gnome/KDE method was better, but I would do it again.  I think it was the best choice out of several poor ones, but that doesn&#8217;t mean I&#8217;m not very happy to be rid of them.</p>
<p>[1] To be fair, there <em>was</em> a more common way, used by some KDE and Gnome projects, which was to put a delimiter in the msgid and keep the context on one side and the original string on the other.  This is also pretty hacky and you can <a href="http://live.gnome.org/GnomeGoals/MsgctxtMigration">read about Gnome&#8217;s migration away from that method</a> if you&#8217;re curious.</p>
]]></content:encoded>
			<wfw:commentRss>http://micropipes.com/blog/2009/09/01/using-substitution-strings-in-po-files/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>High-level Verbatim plan</title>
		<link>http://micropipes.com/blog/2008/11/19/high-level-verbatim-plan/</link>
		<comments>http://micropipes.com/blog/2008/11/19/high-level-verbatim-plan/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 17:39:50 +0000</pubDate>
		<dc:creator>Wil Clouser</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[hindsight]]></category>
		<category><![CDATA[L10n]]></category>
		<category><![CDATA[Verbatim]]></category>

		<guid isPermaLink="false">http://micropipes.com/blog/?p=63</guid>
		<description><![CDATA[Looking over what I&#8217;ve written about Verbatim I realize that I&#8217;ve never talked about the overall plan on here.  Even though we&#8217;re well into it at this point it doesn&#8217;t hurt to review.
The original plan for Verbatim was to branch Pootle and continue to merge code between the branch and trunk as features were [...]]]></description>
			<content:encoded><![CDATA[<p>Looking over what I&#8217;ve written about Verbatim I realize that I&#8217;ve never talked about the overall plan on here.  Even though we&#8217;re well into it at this point it doesn&#8217;t hurt to review.</p>
<p>The original plan for Verbatim was to branch Pootle and continue to merge code between the branch and trunk as features were developed.  As we developed code we realized this just creates more work for developers and makes users have to choose between two branches.  A better method is just to have everyone commit to trunk and write the code in such a way that any site specific code is maintained in configuration files which is what the current plan entails.</p>
<p><strong>Step 1: Branch Pootle.</strong>  <a href="http://www.translate.org.za/blogs/wynand/">Wynand</a> created the <a href="http://translate.svn.sourceforge.net/viewvc/translate/src/branches/mozootle/">Mozootle</a> branch as a place for Mozilla developers to commit.  For the record, Verbatim is the name of the project, Mozootle is the name of the actual branch in the repository; effectively, they are interchangable.</p>
<p><strong>Step 2: Develop Mozootle.</strong>  We used Bugzilla to <a href="http://tinyurl.com/58l55v" title="Verbatim Resolved Bugs (Bugzilla)">track our changes</a> and there are still plenty to do but the first milestone is closed at this point.</p>
<p><strong>Step 3: Merge Mozootle to Trunk.</strong>  This is the stage we&#8217;re currently at.  The <a href="http://translate.org.za/">translate.org.za team</a> has been reviewing the changes in Mozootle and planning out the merging strategy.  There is a <a href="http://translate.sourceforge.net/wiki/developers/mozootle#mozootle_issues">fast moving wiki page</a> tracking issues with the merge right now.  Our current goal is to resolve these and merge in the next couple days.</p>
<p><strong>Step 4: Continue development on Trunk.</strong>  The plan after the merge is for all developers to continue committing code into the Pootle trunk.  What &#8220;development&#8221; means is a post in itself so I&#8217;ll cut this off here.</p>
<p>In hindsight the whole branching and merging process seemed necessary at the time but it doesn&#8217;t feel like we gained much.  Next time I think we&#8217;ll just skip the branch.</p>
]]></content:encoded>
			<wfw:commentRss>http://micropipes.com/blog/2008/11/19/high-level-verbatim-plan/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Thoughts on branching an open source project</title>
		<link>http://micropipes.com/blog/2008/10/17/thoughts-on-branching-an-open-source-project/</link>
		<comments>http://micropipes.com/blog/2008/10/17/thoughts-on-branching-an-open-source-project/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 23:42:29 +0000</pubDate>
		<dc:creator>Wil Clouser</dc:creator>
				<category><![CDATA[Mozilla]]></category>
		<category><![CDATA[hindsight]]></category>
		<category><![CDATA[open web]]></category>
		<category><![CDATA[Verbatim]]></category>

		<guid isPermaLink="false">http://micropipes.com/blog/?p=59</guid>
		<description><![CDATA[I think any good manager will tell you that looking back over the choices you&#8217;ve made is an important step to improvement.  In an effort to improve myself (and help anyone in a similar situation) I wrote this post with a few thoughts about branching an open source project (in this case branching Pootle [...]]]></description>
			<content:encoded><![CDATA[<p>I think any good manager will tell you that looking back over the choices you&#8217;ve made is an important step to improvement.  In an effort to improve myself (and help anyone in a similar situation) I wrote this post with a few thoughts about branching an open source project (in this case branching <a href="http://translate.sourceforge.net/wiki/pootle/index?redirect=1">Pootle</a> to make <a href="https://wiki.mozilla.org/Verbatim">Verbatim</a>).  My goal is not to criticize anyone&#8217;s past decisions, including mine, but just to review the pros and cons and what I would do differently in the future.  So, a few thoughts late on a Friday:</p>
<p>When I started the planning for branching Pootle I was very focused on scalability (or lack thereof) and most of my initial goals were to improve that including replacing flat files with mysql, creating a cacheable URL structure, etc.  In hindsight, I should have realized that this project wasn&#8217;t going to be getting nearly the traffic load some of our other sites were getting and my priorities were out of order.  What I should have been thinking about was usability and interface improvements.  Due to my lack of foresight the project launched with enhancements in both areas but I think the time we spent on scalability was premature and the user interface suffered.</p>
<p>Whether it&#8217;s writing more comments than code or making sure meetings have agendas I&#8217;m a huge fan of communication.  When branching a project, particularly when there are plans to merge the branch back into trunk, communication is vital.  I think <a href="https://wiki.mozilla.org/Verbatim:Meeting_Notepad">our meetings</a> are productive but communication on a smaller scale is still a struggle.  Both Pootle and Verbatim ended up writing the same code in a few cases which could have easily been avoided.  In this particular case the timezones can make it difficult to synchronize but it&#8217;s something I&#8217;ll work at more in the future.</p>
<p>Something we have done a good job with is making a schedule and updating it with new developments.  I really want to expand our effort here though.  I think one of the difficulties of someone joining a project like this is direction; what are the goals of the project and how are we getting there?  Several of us have talked about it on IRC and we all have a good general idea but for someone that isn&#8217;t as involved it&#8217;s hard to follow.  Once we get over the next big hump (replacing <a href="http://jtoolkit.sourceforge.net/">jToolkit</a>) I think this will begin to fall into place with smaller bugs/features revealing themselves and providing a way for volunteers to get footholds on the project as a whole.</p>
<p>Lastly, it might be obvious, but if you&#8217;re planning on maintaining the branch or merging back to trunk make sure you get along with the lead developers.  I&#8217;m fortunate to work with the Pootle developers who clearly care deeply about the project.  From talking to them it&#8217;s obvious they have the end users&#8217; best interests in mind and are excited that we can all work together to improve the end product.  And really, that&#8217;s what open source is all about and it&#8217;s great to be a part of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://micropipes.com/blog/2008/10/17/thoughts-on-branching-an-open-source-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
