<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.5" -->
<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/"
	>

<channel>
	<title>chris clarke</title>
	<link>http://squadlimber.com/chris</link>
	<description>software development that works...or something</description>
	<pubDate>Mon, 07 Apr 2008 23:14:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.5</generator>
	<language>en</language>
			<item>
		<title>Iteration Planning - What I&#8217;ve Found Works Well</title>
		<link>http://squadlimber.com/chris/2008/04/07/iteration-planning-what-ive-found-works-well/</link>
		<comments>http://squadlimber.com/chris/2008/04/07/iteration-planning-what-ive-found-works-well/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 23:14:16 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Agile Planning</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2008/04/07/iteration-planning-what-ive-found-works-well/</guid>
		<description><![CDATA[I&#8217;d like to share the method of planning that I&#8217;ve evolved because I&#8217;ve found it works quite well and better than anything else I&#8217;ve tried so far.  Note: this is used for planning what will go in the next iteration or sprint and not for release planning.  
I take two iterations worth of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d like to share the method of planning that I&#8217;ve evolved because I&#8217;ve found it works quite well and better than anything else I&#8217;ve tried so far.  Note: this is used for planning what will go in the next iteration or <a href="http://www.scrumalliance.org/articles/39-glossary-of-scrum-terms#1118">sprint</a> and not for release planning.  </p>
<p>I take two iterations worth of upcoming work (you may call your upcoming work a <a href="http://www.mountaingoatsoftware.com/product_backlog">Product Backlog</a>) prioritized by the customer and get the team to break each story/feature in to smaller tasks that they are comfortable with.  I then get them to estimate each task in days.  Some people like to estimate in <a href="http://c2.com/cgi/wiki?StoryPoints">Story Points</a> or Jelly Beans, other people like to estimate in Ideal Days (a day where no-one is off-sick and there are no meetings or interruptions).  I&#8217;ve found that for estimating, Plain Old Normal Days work best - developers tend to find it confusing what Story Points mean and they find it difficult to compare stories from one iteration to the next and in relation to each other.  Its much easier for them to think in real units of time because thats just how they perceive things in their heads.  (Note: I also tend to use <a href="http://www.mountaingoatsoftware.com/products/cards">Planning Poker cards</a> - so that ALL the team get input on the estimate and they don&#8217;t let other peoples estimates affect their own). As you read on, you&#8217;ll find that I take these day estimates and treat them as points - as in &#8220;the team completed 18 days of work last iteration&#8221; - which doesn&#8217;t mean they worked for 18 days, but that they completed what was estimated as 18 days (the iteration itself could&#8217;ve been a week).</p>
<p>I&#8217;ve found nothing beats <a href="http://www.scrumalliance.org/articles/39-glossary-of-scrum-terms#1110">velocity</a> based planning.  The velocity is the average number of days the team completes in an iteration.  So say the velocity is 20, I know I can probably fit 20 days worth of work in the next iteration. (Note: Don&#8217;t think you can fit just a little bit more, treat it as a hard limit.  Think you can fit 21? Don&#8217;t do it!).  The reason why I estimate two iterations at once is to give the customer a little flexibility - lets say we go in to a planning session with just one iteration to plan and we come out with two stories, one is 6 days and the other is 8 days but our velocity is only 10 (8 + 6 = 14. It ain&#8217;t gonna fit!).  So having estimated two iterations it gives the customer the option of shuffling some stories around from the other iteration to get a good fit (perhaps another story comes out as a 4 or a 2 - perfect!).</p>
<p>The other important thing that I do is allow a bit of Slack, and by that I don&#8217;t mean I let the team be a bit lazy, put their feet up and watch TV all day.  I mean allowing for a bit of time in the iteration, maybe 10%, maybe less, which is just there for flexibility.  Maybe the time will be used because we underestimated a bit this time round, maybe it will be used to do some long needed refactoring, maybe there&#8217;s a whole stream of unexpected support problems this iteration, maybe the team will use the time to make some changes to go faster next time&#8230; I was born with a brain that likes efficiency and likes to fill up and make the most of every unit of time so the idea of Slack didn&#8217;t really feel natural to me - but hey it works great - I recommend the book <a href="http://www.amazon.com/Slack-Getting-Burnout-Busywork-Efficiency/dp/0767907698?ie=UTF8&#038;s=books&#038;qid=1181505858&#038;sr=8-1">Slack: Getting Past Burnout, Busywork, and the Myth of Total Efficiency</a>.  Another good book, about planning, is <a href="http://www.amazon.com/Agile-Estimating-Planning-Robert-Martin/dp/0131479415">Agile Estimating and Planning</a>.</p>
<p>That&#8217;s it.  Getting the customer to prioiritize stories and agreeing to shuffle them around is the hard part.
</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2008/04/07/iteration-planning-what-ive-found-works-well/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Outsourcing My Own Project</title>
		<link>http://squadlimber.com/chris/2008/04/07/outsourcing-my-own-project/</link>
		<comments>http://squadlimber.com/chris/2008/04/07/outsourcing-my-own-project/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 22:00:25 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Agile Planning</category>

		<category>Testing</category>

		<category>Outsourcing</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2008/04/07/outsourcing-my-own-project/</guid>
		<description><![CDATA[I&#8217;ve decided to outsource one of my own pet projects, I just don&#8217;t realistically have enough time to work on it but I would still like to see it come to life.  I&#8217;m using a site called RentACoder to hire a developer to do the coding.  I don&#8217;t really know quite yet how [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided to outsource one of my own pet projects, I just don&#8217;t realistically have enough time to work on it but I would still like to see it come to life.  I&#8217;m using a site called <a href="http://www.rentacoder.com/">RentACoder</a> to hire a developer to do the coding.  I don&#8217;t really know quite yet how I&#8217;m going to run it, I&#8217;ve started by writing some acceptance criteria, and I&#8217;ll be testing it myself by writing some automated acceptance tests.  Ideally I&#8217;d like to give these tests to the developer first but I&#8217;m not really sure how all this RentACoder stuff works yet - should be a fun experiment!</p>
<p>One of the more interesting things about starting a RentACoder project is the options they present to you regarding time of delivery:</p>
<p><img id="image96" src="http://squadlimber.com/chris/wp-content/uploads/2008/04/deliverytimerentacoder.png" alt="deliverytimerentacoder.png" /></p>
<p>I&#8217;m sure we&#8217;ve all been on one of those Option One &#8220;Project must be delivered in X days&#8221; types.  I&#8217;ve been lucky enough to be on a few Option Two projects and even a few Option One projects where we&#8217;ve negotiated what will be delivered in X days and in what priority.  As my project has no deadline and I don&#8217;t want my Programmer-For-Hire to rush and reduce quality in order to meet a deadline, I plumped for Option Three.</p>
<p>I quite like the question regarding Managing Coder Estimates - its like your signing up to a contract agreeing that all programmers underestimate by either 2 or 5 times!</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2008/04/07/outsourcing-my-own-project/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Compiler Warnings</title>
		<link>http://squadlimber.com/chris/2008/04/04/compiler-warnings/</link>
		<comments>http://squadlimber.com/chris/2008/04/04/compiler-warnings/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 12:30:42 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Cool Stuff</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2008/04/04/compiler-warnings/</guid>
		<description><![CDATA[This post about Compiler Warnings made me laugh.

]]></description>
			<content:encoded><![CDATA[<p>This post about <a href="http://peripateticaxiom.blogspot.com/2008/02/compiler-warnings.html">Compiler Warnings</a> made me laugh.
</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2008/04/04/compiler-warnings/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ignoring Common Coding Practice (why you should be too)</title>
		<link>http://squadlimber.com/chris/2008/04/04/ignoring-common-coding-practice-why-you-should-be-too/</link>
		<comments>http://squadlimber.com/chris/2008/04/04/ignoring-common-coding-practice-why-you-should-be-too/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 00:13:48 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Refactoring</category>

		<category>eXtreme Programming</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2008/04/04/ignoring-common-coding-practice-why-you-should-be-too/</guid>
		<description><![CDATA[Simon Baker wrote a quick blog entry on Common Sense and Common Practice.  It hit home with me because recently I&#8217;ve been pairing with developers who find it uncomfortable coding in certain ways because it doesn&#8217;t fit with Common Practice.  A lot of code I see, whether it be reading a programming book, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.agileinaction.com/">Simon Baker</a> wrote a quick blog entry on <a href="http://www.think-box.co.uk/blog/2008/01/common.html">Common Sense and Common Practice</a>.  It hit home with me because recently I&#8217;ve been pairing with developers who find it uncomfortable coding in certain ways because it doesn&#8217;t fit with Common Practice.  A lot of code I see, whether it be reading a programming book, looking at some code I Googled, or looking back at the way I was taught at University, is really just a bit rubbish in my opinion.  It works okay, and I&#8217;m sure a computer can understand it, but as a human I find myself struggling a bit.  Typically the code seems to be telling me <strong><em>how</em></strong> the computation is taking place rather than <strong><em>what</em></strong> it is doing.  Sure, you need some <strong><em>how</em></strong> code but put it behind a little <strong><em>what</em></strong> code and give me a chance.</p>
<p>Anyway, enough passive-aggressive blogging, here are some things that people tend to find uncomfortable and perhaps why they shouldn&#8217;t:</p>
<h3>Long names</h3>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
&nbsp; &nbsp; @Test <span style="color: #000080;">public</span> <span style="color: #000080;">void</span> findingXMLElementByNameThrowsExceptionWhenElementDoesNotExist<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #000080;">String</span></a> someXmlWithNoFrankTag = <span style="color: #008000;">&quot;...&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3ADocument+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #000080;">Document</span></a> xmlDocument = XmlUtils.<span style="color: #000000;">toDocument</span><span style="color: #000000;">&#40;</span>someXmlWithNoFrankTag<span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">try</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; XmlUtils.<span style="color: #000000;">findElementByName</span><span style="color: #000000;">&#40;</span>xmlDocument, <span style="color: #008000;">&quot;frank&quot;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fail<span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Expected exception to be thrown because the element 'frank' does not exist!&quot;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span> <span style="color: #000080;">catch</span> <span style="color: #000000;">&#40;</span>JDOMException expectedBecauseElementShouldNotBeFound<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp;</div>
<p>Long descriptive names seem uncomfortable to people because you don&#8217;t normally see them in Common Practice.  I think they help because it&#8217;s much easier to see what&#8217;s going on without looking in to the details of the languages implementation and its easier to find code that already does what you want.</p>
<h3>Extracting composed methods that don&#8217;t remove duplication</h3>
<p>Before:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
<span style="color: #000080;">public</span> <span style="color: #000080;">void</span> somebodyCheckedIn<span style="color: #000000;">&#40;</span>CheckIn checkIn<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000080;">for</span> <span style="color: #000000;">&#40;</span>CheckIn checkIn : codeCheckIns<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;christopherc&quot;</span>.<span style="color: #000000;">equals</span><span style="color: #000000;">&#40;</span>checkIn.<span style="color: #000000;">committer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// update web page</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">printTitle</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Code changed by: &quot;</span>&nbsp; &nbsp;checkIn.<span style="color: #000000;">committer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">printHeader</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;On date: &quot;</span>&nbsp; &nbsp;checkIn.<span style="color: #000000;">date</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">printBold</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Changes: &quot;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">for</span> <span style="color: #000000;">&#40;</span>CodeChange codeChange : checkIn.<span style="color: #000000;">codeChanges</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">print</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;File &quot;</span>&nbsp; &nbsp;codeChange.<span style="color: #000000;">fileName</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>&nbsp; &nbsp;<span style="color: #008000;">&quot;: &quot;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">print</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Diff: &quot;</span>&nbsp; &nbsp;PrettyDiffFormatter.<span style="color: #000000;">format</span><span style="color: #000000;">&#40;</span>codeChange.<span style="color: #000000;">diff</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// kick off build</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">if</span> <span style="color: #000000;">&#40;</span>builder.<span style="color: #000000;">isRunning</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">reset</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">emptyBuildQueue</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">addToBuildQueue</span><span style="color: #000000;">&#40;</span><span style="color: #000080;">new</span> Build<span style="color: #000000;">&#40;</span>checkIn<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
&nbsp;</div>
<p>After:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
<span style="color: #000080;">public</span> <span style="color: #000080;">void</span> somebodyCheckedIn<span style="color: #000000;">&#40;</span>CheckIn checkIn<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000080;">for</span> <span style="color: #000000;">&#40;</span>CheckIn checkIn : codeCheckIns<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;christopherc&quot;</span>.<span style="color: #000000;">equals</span><span style="color: #000000;">&#40;</span>checkIn.<span style="color: #000000;">committer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; updateWebPageWithCheckIn<span style="color: #000000;">&#40;</span>checkIn<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stopTheBuildIfItsRunningAndBuild<span style="color: #000000;">&#40;</span>checkIn<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #000080;">private</span> <span style="color: #000080;">void</span> updateWebPageWithCheckIn<span style="color: #000000;">&#40;</span>CheckIn checkIn<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; page.<span style="color: #000000;">printTitle</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Code changed by: &quot;</span>&nbsp; &nbsp;checkIn.<span style="color: #000000;">committer</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; page.<span style="color: #000000;">printHeader</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;On date: &quot;</span>&nbsp; &nbsp;checkIn.<span style="color: #000000;">date</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; page.<span style="color: #000000;">printBold</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Changes: &quot;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #000080;">for</span> <span style="color: #000000;">&#40;</span>CodeChange codeChange : checkIn.<span style="color: #000000;">codeChanges</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">print</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;File &quot;</span>&nbsp; &nbsp;codeChange.<span style="color: #000000;">fileName</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>&nbsp; &nbsp;<span style="color: #008000;">&quot;: &quot;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; page.<span style="color: #000000;">print</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Diff: &quot;</span>&nbsp; &nbsp;PrettyDiffFormatter.<span style="color: #000000;">format</span><span style="color: #000000;">&#40;</span>codeChange.<span style="color: #000000;">diff</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<span style="color: #000000;">&#125;</span><br />
<br />
<span style="color: #000080;">private</span> <span style="color: #000080;">void</span> stopTheBuildIfItsRunningAndBuild<span style="color: #000000;">&#40;</span>CheckIn checkIn<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">if</span> <span style="color: #000000;">&#40;</span>builder.<span style="color: #000000;">isRunning</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">reset</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">emptyBuildQueue</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; builder.<span style="color: #000000;">addToBuildQueue</span><span style="color: #000000;">&#40;</span><span style="color: #000080;">new</span> Build<span style="color: #000000;">&#40;</span>checkIn<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;<br />
<span style="color: #000000;">&#125;</span><br />
&nbsp;</div>
<p>People seem a bit uncomfortable with this refactoring because they think it doesn&#8217;t achieve anything except adding more code.  Sure, no duplication has been removed but its now much clearer what the public method does without having to look in to the imperative details of how it does it in the private methods.  I can now understand this code at a glance after splitting out the two things that were happening inside the loop and as an added benefit I was able to remove some comments by naming the methods well.</p>
<h3>Creating classes to express your domain</h3>
<p><a href="http://ivan.truemesh.com/">Ivan Moore</a> and <a href="http://peripateticaxiom.blogspot.com/">Keith Braithwaite</a> ran a workshop at <a href="http://www.spaconference.org/">SPA 2008</a> on <a href="http://ivan.truemesh.com/archives/000733.html">Programming as if the domain mattered</a> which inspired me on this one.</p>
<p>For example, if you are writing a Banking application, you can create classes that express familiar language in Banking.</p>
<p>Without domain classes:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
&nbsp; &nbsp; <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3AString+java.sun.com&amp;bntI=I%27m%20Feeling%20Lucky"><span style="color: #000080;">String</span></a> customer = <span style="color: #008000;">&quot;Mr Clarke&quot;</span>;<br />
&nbsp; &nbsp; <span style="color: #000080;">long</span> custId = <span style="color: #0000ff;">234234555</span>;<br />
&nbsp; &nbsp; <span style="color: #000080;">double</span> amount = <span style="color: #0000ff;">500.0</span>;<br />
&nbsp; &nbsp; <span style="color: #000080;">double</span> interest = <span style="color: #0000ff;">1.055</span>;<br />
&nbsp; &nbsp; Account account = <span style="color: #000080;">new</span> Account<span style="color: #000000;">&#40;</span>customer, custId, <span style="color: #000080;">null</span>, <span style="color: #000080;">null</span>, <span style="color: #0000ff;">0.0</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; account.<span style="color: #000000;">open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; account.<span style="color: #000000;">setAmount</span><span style="color: #000000;">&#40;</span>amount * interest<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; database.<span style="color: #000000;">save</span><span style="color: #000000;">&#40;</span>account<span style="color: #000000;">&#41;</span>;<br />
&nbsp;</div>
<p>With domain classes:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
&nbsp; &nbsp; Customer customer = <span style="color: #000080;">new</span> Customer<span style="color: #000000;">&#40;</span><span style="color: #008000;">&quot;Mr Clarke&quot;</span>, <span style="color: #0000ff;">234234555</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; Money money = <span style="color: #000080;">new</span> Money<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">500.0</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; Interest interest = <span style="color: #000080;">new</span> Interest<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">5.5</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; Account account = customer.<span style="color: #000000;">openAccount</span><span style="color: #000000;">&#40;</span>money<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; account.<span style="color: #000000;">addInterest</span><span style="color: #000000;">&#40;</span>interest<span style="color: #000000;">&#41;</span>;<br />
&nbsp; &nbsp; database.<span style="color: #000000;">save</span><span style="color: #000000;">&#40;</span>account<span style="color: #000000;">&#41;</span>;<br />
&nbsp;</div>
<p>I&#8217;ve found people are put off by this domain language because a lot of the classes involved don&#8217;t achieve much, you&#8217;ll have to imagine a lot of them for yourself but for example the Money class could start life as pretty much a wrapper around a primitive:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
<span style="color: #000080;">public</span> <span style="color: #000080;">class</span> Money <span style="color: #000000;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000080;">private</span> <span style="color: #000080;">double</span> amount;<br />
<br />
&nbsp; &nbsp; <span style="color: #000080;">public</span> Money <span style="color: #000000;">&#40;</span><span style="color: #000080;">double</span> amount<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000080;">this</span>.<span style="color: #000000;">amount</span> = amount;<br />
&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// ...</span><br />
<span style="color: #000000;">&#125;</span><br />
&nbsp;</div>
<p>Another argument against is that it increases memory footprint - and hey if that&#8217;s really really (come on is it really?) important to you then just use primitives.</p>
<h3>Be Brave</h3>
<p>I wish people would be a bit braver and use the code to express what they are trying to do and not worry about whether the way they are doing it is against Common Practice.  Remember, the majority of software projects are still failures, so why follow Common Practice - it isn&#8217;t working!</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2008/04/04/ignoring-common-coding-practice-why-you-should-be-too/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using an SVN client with Team Foundation Server</title>
		<link>http://squadlimber.com/chris/2007/11/16/using-an-svn-client-with-team-foundation-server/</link>
		<comments>http://squadlimber.com/chris/2007/11/16/using-an-svn-client-with-team-foundation-server/#comments</comments>
		<pubDate>Fri, 16 Nov 2007 18:52:37 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Continuous Integration</category>

		<category>Tools n Stuff</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/11/16/using-an-svn-client-with-team-foundation-server/</guid>
		<description><![CDATA[Tim Goodwin blogs about SvnBridge.  Its a tool for being able to use Subversion clients with Team Foundation Server.  I quite like the idea of creating good interfaces to bad systems, however it would be much easier if people stopped making bad systems.

]]></description>
			<content:encoded><![CDATA[<p><a href="http://trgoodwin.blogspot.com/2007/11/interesting-tool-svnbridge.html">Tim Goodwin</a> blogs about <a href="http://www.codeplex.com/SvnBridge">SvnBridge</a>.  Its a tool for being able to use <a href="http://subversion.tigris.org/">Subversion</a> clients with <a href="http://en.wikipedia.org/wiki/Team_Foundation_Server">Team Foundation Server</a>.  I quite like the idea of creating good interfaces to bad systems, however it would be much easier if people stopped making bad systems.
</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/11/16/using-an-svn-client-with-team-foundation-server/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mocking Concrete Classes in JMock 2</title>
		<link>http://squadlimber.com/chris/2007/11/15/mocking-classes-in-jmock-2/</link>
		<comments>http://squadlimber.com/chris/2007/11/15/mocking-classes-in-jmock-2/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 10:44:22 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Tools n Stuff</category>

		<category>Testing</category>

		<category>Java</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/11/15/mocking-classes-in-jmock-2/</guid>
		<description><![CDATA[In JMock 1 you extended the cglib version of MockObjectTestCase but in JMock 2 its different.  You need to change the Imposteriser used by the Mockery:

Mockery context = new Mockery&#40;&#41;;
context.setImposteriser&#40;ClassImposteriser.INSTANCE&#41;;
&#160;
]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.jmock.org/">JMock 1</a> you extended the cglib version of MockObjectTestCase but in <a href="http://www.jmock.org/">JMock 2</a> its different.  You need to change the Imposteriser used by the Mockery:</p>
<div class="java" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
Mockery context = <span style="color: #000080;">new</span> Mockery<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br />
context.<span style="color: #000000;">setImposteriser</span><span style="color: #000000;">&#40;</span>ClassImposteriser.<span style="color: #000000;">INSTANCE</span><span style="color: #000000;">&#41;</span>;<br />
&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/11/15/mocking-classes-in-jmock-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Find which process is listening on a port</title>
		<link>http://squadlimber.com/chris/2007/10/17/find-which-process-is-listening-on-a-port/</link>
		<comments>http://squadlimber.com/chris/2007/10/17/find-which-process-is-listening-on-a-port/#comments</comments>
		<pubDate>Wed, 17 Oct 2007 18:20:04 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Unix</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/10/17/find-which-process-is-listening-on-a-port/</guid>
		<description><![CDATA[To find which process is listening on port 22:

lsof -i:22
&#160;
Find out which port a process is listening on e.g. httpd:

lsof -P -c httpd -a -i
&#160;
Or by PID:

lsof -P -p 267 -a -i
&#160;
lsof can also be used to find the files a process has open.  To look for where httpd writes it&#8217;s log files:

lsof -c [...]]]></description>
			<content:encoded><![CDATA[<p>To find which process is listening on port 22:</p>
<div class="bash" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
lsof -i:<span style="color: #cc66cc;">22</span><br />
&nbsp;</div>
<p>Find out which port a process is listening on e.g. httpd:</p>
<div class="bash" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
lsof -P -c httpd -a -i<br />
&nbsp;</div>
<p>Or by PID:</p>
<div class="bash" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
lsof -P -p <span style="color: #cc66cc;">267</span> -a -i<br />
&nbsp;</div>
<p>lsof can also be used to find the files a process has open.  To look for where httpd writes it&#8217;s log files:</p>
<div class="bash" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
lsof -c httpd | grep log<br />
&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/10/17/find-which-process-is-listening-on-a-port/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Unix stuff</title>
		<link>http://squadlimber.com/chris/2007/10/17/unix-stuff/</link>
		<comments>http://squadlimber.com/chris/2007/10/17/unix-stuff/#comments</comments>
		<pubDate>Wed, 17 Oct 2007 17:58:26 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Unix</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/10/17/unix-stuff/</guid>
		<description><![CDATA[If you work a lot on slow Solaris boxes, you can speed up finds a little bit:

find . -depth -type f -name '*.monkeys'
&#160;
The depth option looks at the contents of directories before the directory itself and the &#8216;type f&#8217; constricts the find to only look at regular files.  You can speed it up a [...]]]></description>
			<content:encoded><![CDATA[<p>If you work a lot on slow Solaris boxes, you can speed up finds a little bit:</p>
<div class="bash" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
find . -depth -<span style="color: #000066;">type</span> f -name <span style="color: #ff0000;">'*.monkeys'</span><br />
&nbsp;</div>
<p>The depth option looks at the contents of directories before the directory itself and the &#8216;type f&#8217; constricts the find to only look at regular files.  You can speed it up a bit more if you have more information about the file e.g. the owner:</p>
<div class="bash" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
find . -depth -<span style="color: #000066;">type</span> f -user dev -name <span style="color: #ff0000;">'*.monkeys'</span><br />
&nbsp;</div>
<p>Looking for something inside a file and only want to list the files containing your search:</p>
<div class="bash" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
grep -l monkeys *<br />
&nbsp;</div>
<p>Working on a box that doesn&#8217;t have recursive grep:</p>
<div class="bash" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
find -X . -depth -<span style="color: #000066;">type</span> f -name <span style="color: #ff0000;">'*'</span> | xargs grep -l monkeys<br />
&nbsp;</div>
<p>The &#8216;-X&#8217; option ignores files that would mess with xargs e.g. filenames with spaces in.</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/10/17/unix-stuff/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How many developers does it take to change a light bulb?</title>
		<link>http://squadlimber.com/chris/2007/09/30/how-many-developers-does-it-take-to-change-a-light-bulb/</link>
		<comments>http://squadlimber.com/chris/2007/09/30/how-many-developers-does-it-take-to-change-a-light-bulb/#comments</comments>
		<pubDate>Sun, 30 Sep 2007 19:31:01 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>Uncategorized</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/09/30/how-many-developers-does-it-take-to-change-a-light-bulb/</guid>
		<description><![CDATA[ Well, you gotta re-deploy the lightbulb application, should take a couple of minutes right?  First up you have to upgrade CrappyAppServer because the boss said so. OK, so you install the new version of CrappyAppServer, but there&#8217;s a problem, you&#8217;ve run out of disk quota.  But you can&#8217;t increase the disk quota [...]]]></description>
			<content:encoded><![CDATA[<p><img id="image87" align="right" style="border: 1px solid #666; margin: 15px" src="http://squadlimber.com/chris/wp-content/uploads/2007/09/changinglightbulb1.jpg" alt="changinglightbulb1.jpg" /> Well, you gotta re-deploy the lightbulb application, should take a couple of minutes right?  First up you have to upgrade CrappyAppServer because the boss said so. OK, so you install the new version of CrappyAppServer, but there&#8217;s a problem, you&#8217;ve run out of disk quota.  But you can&#8217;t increase the disk quota yourself, you have to contact some other guy in some other department.  You send the guy an email.  Nothing. You escalate it to his manager.  You get an email, apparently you have to fill out a form to get the disk quota increased.  You ask &#8220;Do I really have to fill out the form? I only need a few more gigs and you only have to run one command.&#8221;.  Yes, apparently without the form and appropriate signatures it can&#8217;t be &#8216;processed&#8217;.  Now the form requires you to know the physical location of the box  but of course you don&#8217;t know so you have to contact some other guy in some other department and it goes on and on and on &#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/09/30/how-many-developers-does-it-take-to-change-a-light-bulb/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Private, Public and Static in JavaScript</title>
		<link>http://squadlimber.com/chris/2007/09/22/private-public-and-static-in-javascript/</link>
		<comments>http://squadlimber.com/chris/2007/09/22/private-public-and-static-in-javascript/#comments</comments>
		<pubDate>Sat, 22 Sep 2007 16:30:32 +0000</pubDate>
		<dc:creator>chris.probably</dc:creator>
		
		<category>JavaScript</category>

		<guid isPermaLink="false">http://squadlimber.com/chris/2007/09/22/private-public-and-static-in-javascript/</guid>
		<description><![CDATA[JavaScript doesn&#8217;t have keywords for making things private, public or static like other languages but it is possible - unfortunately like most things in JavaScript it&#8217;s possible in several different ways!
Public and private access in JavaScript
To declare a method public in JavaScript you can assign it to the prototype:

// The class
Monkey = function &#40;&#41; &#123;&#125;;

// [...]]]></description>
			<content:encoded><![CDATA[<p>JavaScript doesn&#8217;t have keywords for making things private, public or static like other languages but it is possible - unfortunately like most things in JavaScript it&#8217;s possible in several different ways!</p>
<h3>Public and private access in JavaScript</h3>
<p>To declare a method public in JavaScript you can assign it to the prototype:</p>
<div class="javascript" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
<span style="color: #009900; font-style: italic;">// The class</span><br />
Monkey = <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>;<br />
<br />
<span style="color: #009900; font-style: italic;">// The public method getBananas</span><br />
Monkey.<span style="color: #006600;">prototype</span>.<span style="color: #006600;">getBananas</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> ... <span style="color: #66cc66;">&#125;</span>;<br />
&nbsp;</div>
<p>..or you can also assign it to <b>this</b> in the constructor:</p>
<div class="javascript" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
Monkey = <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">getBananas</span> = <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> ... <span style="color: #66cc66;">&#125;</span>;<br />
<span style="color: #66cc66;">&#125;</span>;<br />
&nbsp;</div>
<p>To make things private you can take different approaches aswell.  You can just define them to a <b>var</b> in the constructor:</p>
<div class="javascript" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
Monkey = <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> privateMethod = <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> ... <span style="color: #66cc66;">&#125;</span>;<br />
<span style="color: #66cc66;">&#125;</span>;<br />
&nbsp;</div>
<p>&#8230;or you can use the <a href="http://www.lixo.org/archives/2007/09/14/javascript-put-everything-in-a-namespace/">approach Carlos Villela suggests</a> and define your public and private methods in different objects inside the constructor and return the public object:</p>
<div class="javascript" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
Monkey = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> <span style="color: #003366; font-weight: bold;">private</span> = <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; privateMethod : <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> ... <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> <span style="color: #003366; font-weight: bold;">public</span> = <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; getBananas : <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> ... <span style="color: #66cc66;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>;<br />
<br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">public</span>;<br />
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br />
&nbsp;</div>
<h3>Static members in JavaScript</h3>
<p>Static members are easy, you just define them directly on the class:</p>
<div class="javascript" style="margin: 35px; border: 1px dashed #eee; font-family: Arial, Monaco, Verdana, monospace; padding: 1em; color: black; background: #fcfcfc; overflow: auto;"><br />
Monkey.<span style="color: #006600;">MAX_BANANAS</span> = <span style="color: #CC0000;">120</span>;<br />
<br />
Monkey.<span style="color: #006600;">swingFromTree</span> = <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> ... <span style="color: #66cc66;">&#125;</span><br />
&nbsp;</div>
]]></content:encoded>
			<wfw:commentRss>http://squadlimber.com/chris/2007/09/22/private-public-and-static-in-javascript/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
