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

<channel>
	<title>Fabio Pereira</title>
	<atom:link href="http://fabiopereira.me/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://fabiopereira.me/blog</link>
	<description>My thoughts and ideas on Software Development  - Agile, XP, Scrum, Lean, Java, Ruby on Rails</description>
	<pubDate>Mon, 09 Aug 2010 12:24:42 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>Romain Highlighting</title>
		<link>http://fabiopereira.me/blog/2010/08/04/romain-highlighting/</link>
		<comments>http://fabiopereira.me/blog/2010/08/04/romain-highlighting/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 12:27:37 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://fabiopereira.me/blog/2010/08/04/romain-highlighting/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://fabiopereira.me/blog/wp-content/uploads/2010/08/romain-highlighting-2.png"><img class="aligncenter size-full wp-image-333" title="romain-highlighting-2" src="http://fabiopereira.me/blog/wp-content/uploads/2010/08/romain-highlighting-2.png" alt="" width="500" height="145" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://fabiopereira.me/blog/2010/08/04/romain-highlighting/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What is this #dearscott all about?</title>
		<link>http://fabiopereira.me/blog/2010/07/10/what-is-this-dearscott-all-about/</link>
		<comments>http://fabiopereira.me/blog/2010/07/10/what-is-this-dearscott-all-about/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 10:26:27 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://fabiopereira.me/blog/2010/07/10/what-is-this-dearscott-all-about/</guid>
		<description><![CDATA[I had some people asking me what is this whole #dearscott all about… 
Basically, Danni McBride found this ad on facebook:
 
When you clicked on it, you were taken to Scott’s microsite prepared especially to amaze us from ThoughtWorks. The guy really knows TW and what we like… Very persuasive, brilliant.
Quickly, #dearscott on twitter was [...]]]></description>
			<content:encoded><![CDATA[<p>I had some people asking me what is this whole #dearscott all about… </p>
<p>Basically, Danni McBride found this ad on facebook:</p>
<p align="center"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="dearscotttw" border="0" alt="dearscotttw" src="http://fabiopereira.me/blog/wp-content/uploads/2010/07/dearscotttw.png" width="321" height="134" /> </p>
<p>When you clicked on it, you were taken to <a href="http://tw.quadhome.com" target="_blank">Scott’s microsite</a> prepared especially to amaze us from ThoughtWorks. The guy really knows TW and what we like… Very persuasive, brilliant.</p>
<p>Quickly, <a href="http://twitter.com/search?q=%23DearScott" target="_blank">#dearscott</a> on twitter was created.</p>
<p>I was quite surprised to see that people from Sydney office gathered to take <a href="http://yfrog.com/0dqy2dj" target="_blank">this photo</a>. It’s hard to get everyone in the office given most of the people are assigned to projects on the client site.</p>
<p align="center"><a href="http://yfrog.com/0dqy2dj" target="_blank"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="dearscottgday" border="0" alt="dearscottgday" src="http://fabiopereira.me/blog/wp-content/uploads/2010/07/dearscottgday.jpg" width="644" height="484" /></a> </p>
<p>We haven’t interviewed Scott yet, but one thing we can say about him, he is creative and he managed to get his message through.</p>
]]></content:encoded>
			<wfw:commentRss>http://fabiopereira.me/blog/2010/07/10/what-is-this-dearscott-all-about/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Fable of the Roasted Pigs and the Certified Anemotechnicians</title>
		<link>http://fabiopereira.me/blog/2010/06/23/the-fable-of-the-roasted-pigs-and-the-certified-anemotechnicians/</link>
		<comments>http://fabiopereira.me/blog/2010/06/23/the-fable-of-the-roasted-pigs-and-the-certified-anemotechnicians/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 12:57:36 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://fabiopereira.me/blog/2010/06/23/the-fable-of-the-roasted-pigs-and-the-certified-anemotechnicians/</guid>
		<description><![CDATA[Once upon a time, a forest where some pigs lived, caught on fire and all the pigs were roasted. People, who at that time were in the habit of eating raw meat only, tasted the roasted pigs and found them delicious. 
From that time on, whenever men wanted roasted pork they set a forest on [...]]]></description>
			<content:encoded><![CDATA[<p align="justify">Once upon a time, a forest where some pigs lived, caught on fire and all the pigs were roasted. People, who at that time were in the habit of eating raw meat only, tasted the roasted pigs and found them delicious. </p>
<p align="justify">From that time on, whenever men wanted roasted pork <strong>they set a forest on fire</strong>.</p>
<p align="center"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="fable-of-roasted-pigs" border="0" alt="fable-of-roasted-pigs" src="http://fabiopereira.me/blog/wp-content/uploads/2010/06/fableofroastedpigs.jpg" width="500" height="406" /> </p>
<p align="justify">The demand for roasted pork increased and it became a big business and it generated a lot of jobs. </p>
<p align="justify">There were men who worked at setting the woods on fire (firemen). There were weather consultancies with experts studying and advising other companies on the best weather conditions to achieve the best roasted pigs. There were also the <em>wind specialists</em> who could be trained and become <em>Certified Anemotechnicians</em>. </p>
<p align="center"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Certified-Anemotecnitian" border="0" alt="Certified-Anemotecnitian" src="http://fabiopereira.me/blog/wp-content/uploads/2010/06/certifiedanemotecnitian.jpg" width="500" height="223" /> </p>
<p align="justify">Due to the many bad points of &quot;the system&quot; complaints grew at an increasing rate, as the system expanded to involve more and more people. It was obvious that ”the system” should be drastically changed. Thus every year there were any number of conventions, and congresses, and a considerable amount of time and effort was spent on research to find a solution. </p>
<p>Those who were experts on the subject put down the failure of the system to: </p>
<ul>
<li>a lack of discipline on the part of the pigs, who would not stay where they should</li>
<li>or to the inconstant nature of fire, which was hard to control</li>
<li>or to the trees, which were too green to burn well</li>
</ul>
<p>&#160;</p>
<p>One day a fireman named <strong>John Commonsense</strong> said that the problem was really very simple and easily solved. Only four steps need to be followed: </p>
<ul>
<li>the chosen pig had to be killed</li>
<li>cleaned</li>
<li>placed in the proper utensil </li>
<li>placed over the fire so that it would be cooked by the effect of the heat and not by the effect of the flames.     </li>
</ul>
<p align="justify">The <strong>director general of roasting</strong> himself came and asked Commonsense what he had to say about the problem, and after hearing the four point idea he said:</p>
<p align="justify"><em>- &quot;What you say is absolutely right&#8211;in theory, but it won’t work in practice. What would we do with our weather experts, for instance?&quot;     <br />- &quot;I don&#8217;t know,&quot; </em>answered John.    <br /><em>- “And what shall be done with the forests that are ready to be burned - forests of the right kind of trees needed to produce the right kind of fire, trees that have neither fruit, nor leaves enough for shade, so that they are good only for burning? What shall be done with them? Tell me!&quot;     <br />- &quot;I don&#8217;t know.&quot;      <br />- “What you must bring, are realistic solutions, methods to train better wind technicians. We have <strong>to improve what we have</strong>; we cannot ignore history. So bring me a plan. That is what we need. You are lacking in good judgement, Commonsense! Tell me, if your plan is adopted, what would I do with such experts as the president of the committee to study the integral use of the remnants of the ex-forests?&quot;</em>    <br /><em>&quot;I&#8217;m really perplexed,&quot;</em> said John.    </p>
<p>Poor John Commonsense didn&#8217;t utter a word. Without so much as saying goodbye, stupefied with fright and puzzled by the barriers put in front of him, he went away and was never seen again.</p>
<p align="justify">It was never known where he went. That is why it is often said that when it comes to <strong>reforming the system, Commonsense is missing.</strong></p>
<p align="center">This is an adapted version of the original <a href="http://www.csus.edu/indiv/o/oreyd/quotes/pig.htm" target="_blank">Fable of the Roasted Pigs</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://fabiopereira.me/blog/2010/06/23/the-fable-of-the-roasted-pigs-and-the-certified-anemotechnicians/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ThoughtWorks Brisbane Office</title>
		<link>http://fabiopereira.me/blog/2010/06/22/thoughtworks-brisbane-office/</link>
		<comments>http://fabiopereira.me/blog/2010/06/22/thoughtworks-brisbane-office/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 13:45:31 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://fabiopereira.me/blog/2010/06/22/thoughtworks-brisbane-office/</guid>
		<description><![CDATA[A ThoughtWorks office in Brisbane was officially opened last week. We had already had an office in Brisbane, but it’s been closed and now we reopened it. 
Trevor, our CEO came to cut the ribbon. We had a Declaration of Independency from Sydney and Melbourne offices and at the restaurant I had snails for the [...]]]></description>
			<content:encoded><![CDATA[<p>A ThoughtWorks office in Brisbane was officially opened last week. We had already had an office in Brisbane, but it’s been closed and now we reopened it. </p>
<p>Trevor, our CEO came to cut the ribbon. We had a Declaration of Independency from Sydney and Melbourne offices and at the restaurant I had snails for the first time, with Romain’s and <a href="http://www.facebook.com/#!/dannimcbride?ref=ts" target="_blank">Danni</a>’s support <img src='http://fabiopereira.me/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I’m still based in Sydney, but assigned to a project in Brisbane for around 3 months. I’m pretty happy with it, especially because of the great people we have here.</p>
<p>Go Brisbane!!! Thanks Danni and Super Dooper Dan Gower for the help setting up the office.</p>
<p align="center"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="TW Brisbane Offic" border="0" alt="TW Brisbane Offic" src="http://fabiopereira.me/blog/wp-content/uploads/2010/06/twbrisbaneoffic.png" width="1020" height="487" /> </p>
<p align="center">Photos by <a href="http://www.facebook.com/#!/dannimcbride?ref=ts" target="_blank">Danni McBride</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fabiopereira.me/blog/2010/06/22/thoughtworks-brisbane-office/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Consultancy is like riding a running horse</title>
		<link>http://fabiopereira.me/blog/2010/05/30/consultancy-is-like-riding-a-running-horse/</link>
		<comments>http://fabiopereira.me/blog/2010/05/30/consultancy-is-like-riding-a-running-horse/#comments</comments>
		<pubDate>Mon, 31 May 2010 05:20:06 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://fabiopereira.me/blog/2010/05/30/consultancy-is-like-riding-a-running-horse/</guid>
		<description><![CDATA[I just finished the book Yes! 50 Secrets from the Science of Persuasion, in fact I finished listening to it I have been using Audible to download some audio books, it’s really good actually. 
One interesting metaphor in the book mentions that if we want to change one’s behaviour, or if we want them to [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished the book <a href="http://www.amazon.co.uk/Yes-50-Secrets-Science-Persuasion/dp/1846680166" target="_blank">Yes! 50 Secrets from the Science of Persuasion</a>, in fact I finished <em>listening</em> to it I have been using <a href="http://www.audible.com" target="_blank">Audible</a> to download some audio books, it’s really good actually. </p>
<p>One interesting metaphor in the book mentions that if we want to change one’s behaviour, or if we want them to agree with us on some subject which is different from their current beliefs, it is like riding a running horse… Basically if you try to jump on the horse and at the same time steer him towards another direction, it’s very likely that you will fall… However, if you jump on the horse and <strong>ride towards the same direction that the horse is going</strong> for some time and <strong>slowly steer him towards the direction you want him to go</strong>, then it is more likely that you will get some success. </p>
<p>Eventually you and the horse will be going towards a direction which is neither the original horse’s nor the one you had in mind when jumped on it… Both will learn from each other what’s the best way to go.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="consultant ridinga horse" border="0" alt="consultant ridinga horse" src="http://fabiopereira.me/blog/wp-content/uploads/2010/05/consultantridingahorse.jpg" width="400" height="131" /></p>
</p>
</p>
</p>
</p>
<p align="center">Photos from <a href="http://forum.iranproud.com/pictures-of-the-day-29-december-2008-t212178.html?p=1624263#post1624263" target="_blank">here</a> and <a href="http://oxleylearning.org/germandictionary/2008/11/horse-riding-2/" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fabiopereira.me/blog/2010/05/30/consultancy-is-like-riding-a-running-horse/feed/</wfw:commentRss>
		</item>
		<item>
		<title>BDD with Scenario Code DSL &#8211; Sometimes you don&#8217;t need a tool</title>
		<link>http://fabiopereira.me/blog/2010/05/28/bdd-with-scenario-code-dsl-sometimes-you-dont-need-a-tool/</link>
		<comments>http://fabiopereira.me/blog/2010/05/28/bdd-with-scenario-code-dsl-sometimes-you-dont-need-a-tool/#comments</comments>
		<pubDate>Sat, 29 May 2010 06:10:30 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<category><![CDATA[BDD]]></category>

		<category><![CDATA[Code]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://fabiopereira.me/blog/2010/05/27/bdd-with-scenario-code-dsl-sometimes-you-dont-need-a-tool/</guid>
		<description><![CDATA[My previous project was distributed across cities and we had almost 30 people involved. Communication and the understanding of what needs to be done are crucial for the success of the project. 
One of the big challenges was to make sure that the business and the technical people shared the same domain Ubiquitous Language. To [...]]]></description>
			<content:encoded><![CDATA[<p>My previous project was distributed across cities and we had almost 30 people involved. Communication and the understanding of what needs to be done are crucial for the success of the project. </p>
<p>One of the big challenges was to make sure that the business and the technical people shared the same domain <a href="http://domaindrivendesign.org/node/132" target="_blank">Ubiquitous Language</a>. To ensure that, we started using <a href="http://jbehave.org/" target="_blank">JBehave</a> to define the acceptance criteria of the stories. Half way through, there was a big change which required many changes in the scenarios… </p>
<p><strong>Some issues that we found:</strong></p>
<ul>
<li>The scenarios are text files and extremely hard to refactor. </li>
<li>We had to change the text files (scenarios) and the Java files and keep them in sync </li>
<li>Too much duplication </li>
<li>When writing the scenarios we had no such thing as auto completion </li>
<li>When running the scenarios, we could not run 1 scenario at at time, but the whole file </li>
</ul>
<p>&#160;</p>
<p align="center"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Slide 28052010 111155 AM" border="0" alt="Slide 28052010 111155 AM" src="http://fabiopereira.me/blog/wp-content/uploads/2010/05/slide28052010111155am.jpg" width="500" height="313" /> </p>
<p>The solution was to abstract our own <strong>code</strong> with a <strong>DSL layer</strong> and use it for documentation purposes. Initially we called this JMisbehave because the initial intent was to generate a read only version of the code that we could show to non-technical people and agree on acceptance criteria, as well as keep an executable documentation of the application. <strong>Code Humaniser</strong> was another suggested name… </p>
<p align="center">&#160;<img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Fullscreen capture 28052010 42326 PM" border="0" alt="Fullscreen capture 28052010 42326 PM" src="http://fabiopereira.me/blog/wp-content/uploads/2010/05/fullscreencapture2805201042326pm.jpg" width="500" height="272" />&#160; </p>
<p>Eventually we realised that the code itself was sufficient and we ended up not using the code that generated the read only version of it. Nevertheless it’s still useful in many environments. Many times we showed the code to non-technical people and they were quite delighted to see how straight forward it was to read and to understand. Moreover, it was expressing the <strong>Language of the Business</strong>. An interesting thing is that our colleague Dan North, who wrote JBehave, came to our project one day to facilitate a retrospective and we told him the whole story. He quite liked what we had done and was quite complimentary about the fact that we had understood the concept of DDD and BDD, and the fact that it’s not about the tools. It was actually his recommendation to use <em><strong>the_underscore_notation</strong></em> instead of <em><strong>theCamelCaseNotation</strong>, </em>we had some discussions about that, but that will be described on another post.</p>
</p>
<p><strong><u>Behind the Scenes - The Scenario Code DSL Implementation</u></strong></p>
<p>James Barritt saw another post of mine with some of our Scenarios Code DSL examples and suggested that I wrote a post explaining what was happening “behind the scenes”.&#160; Here is a high level diagram of how we separated the layers:</p>
<p align="center">&#160;<img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Fullscreen capture 28052010 43759 PM" border="0" alt="Fullscreen capture 28052010 43759 PM" src="http://fabiopereira.me/blog/wp-content/uploads/2010/05/fullscreencapture2805201043759pm.jpg" width="400" height="190" /> </p>
</p>
<p>Some code:</p>
<p><strong>Scenarios Code</strong></p>
<pre class="java" name="code">
public class Location_Scenario extends BaseScenario {
  public void should_default_risk_address_when_insured_address_is_valid_for_risk() {
    given(the_broker. has_started_a_home_quote());
    when(the_broker. selects_a_valid_location_for_risk_address());
    then(the_policy.has_home_risk_location_and_risk_address_as_same());
  }
}

public class BaseScenario {
  protected Broker the_broker;
  protected Policy the_policy;
  (...)

  protected &lt;T extends DSL&gt; T given(T dsl) {
    return dsl;
  }

  protected &lt;T extends DSL&gt; T when(T dsl) {
    return dsl;
  }

  protected &lt;T extends DSL&gt; T then(T dsl) {
    return dsl;
  }

  protected &lt;T extends DSL&gt; T and(T dsl) {
    return dsl;
  }

}</pre>
<p><strong>DSL Code</strong></p>
<pre class="java" name="code">public class Broker extends DSL {
  public FieldEnterer enters;
  public Policy the_policy;

  public Broker blah() {
     // call implemenation
    return this;
  }
}

public class Policy extends DSL {
  public FieldEnterer enters;
  (...)
  public Policy blah() {
     // call implemenation
    return this;
  }
}</pre>
<p>
This was a project with lots of people coming in and out all the time and every time someone new would join, the time taken to understand the code and relate it to the business terminology was extremely reduced by the way our tests were written.<br />
You can do the same on your project, write your tests using the language of the business.</p>
]]></content:encoded>
			<wfw:commentRss>http://fabiopereira.me/blog/2010/05/28/bdd-with-scenario-code-dsl-sometimes-you-dont-need-a-tool/feed/</wfw:commentRss>
		</item>
		<item>
		<title>TTDD &#8211; Tautological Test Driven Development (Anti Pattern)</title>
		<link>http://fabiopereira.me/blog/2010/05/27/ttdd-tautological-test-driven-development-anti-pattern/</link>
		<comments>http://fabiopereira.me/blog/2010/05/27/ttdd-tautological-test-driven-development-anti-pattern/#comments</comments>
		<pubDate>Thu, 27 May 2010 11:21:00 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<category><![CDATA[Code]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://fabiopereira.me/blog/2010/05/25/ttdd-tautological-test-driven-development-anti-pattern/</guid>
		<description><![CDATA[One of the advantages of being a consultant is getting to see different environments and being able to visualise and identify patterns and anti-patterns.
&#8220;An anti-pattern is a pattern that may be commonly used but is ineffective and/or counterproductive in practice&#8221; http://en.wikipedia.org/wiki/Anti-pattern
As a first step, let’s describe TTDD – Tautological Test Driven Development as an anti-pattern [...]]]></description>
			<content:encoded><![CDATA[<p>One of the advantages of being a consultant is getting to see different environments and being able to visualise and identify patterns and anti-patterns.</p>
<p align="center"><em>&#8220;An anti-pattern is a pattern that may be commonly used but is ineffective and/or counterproductive in practice&#8221; </em><a href="http://en.wikipedia.org/wiki/Anti-pattern">http://en.wikipedia.org/wiki/Anti-pattern</a></p>
<p align="left">As a first step, let’s describe TTDD – Tautological Test Driven Development as an anti-pattern of <a href="http://en.wikipedia.org/wiki/Test-driven_development" target="_blank">TDD</a> (TestDrivenDevelopment). In fact TTDD is a big enemy of the combination <a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development" target="_blank">BDD</a> (BehaviourDrivenDesign) and TDD.</p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="tdd-and-bdd-vs-ttdd" src="http://fabiopereira.me/blog/wp-content/uploads/2010/05/tddandbddvsttdd.jpg" border="0" alt="tdd-and-bdd-vs-ttdd" width="507" height="381" /></p>
<p>I still have the vivid memory of the day that I was pairing with Dave Coombes and he mentioned that one of the tests I had written was <strong>tautological</strong>.</p>
<p><em>Tautological:<br />
- needless, redundant repetition of an idea<br />
- repetition of same sense in different words;<br />
- the phrase &#8220;a beginner who has just started&#8221; is tautological </em></p>
<p>I did not quite understand at first why the test was <strong>tautological</strong>, i.e. needless, redundant.<br />
As a perfect leader and coach that Dave is, he helped me rewrite the test in a different way and that was when I finally understood what he had meant by that.</p>
<p><strong><span style="text-decoration: underline;">Example</span></strong></p>
<p>The example below is simplified version of the one that Dave and I were using at the time.<br />
In this example, we want to test the class <strong>CarRepository</strong> that interacts with 2 collaborators as shown below:</p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Fullscreen capture 26052010 122651 PM" src="http://fabiopereira.me/blog/wp-content/uploads/2010/05/fullscreencapture26052010122651pm.jpg" border="0" alt="Fullscreen capture 26052010 122651 PM" width="550" height="363" /></p>
<p>In order for <strong>CarRepository</strong> to retrieve all the cars from CarService it needs a ServiceHeader that is provided by ServiceHeaderFactory. For the purposes of this example, I’ll show the implementation of CarRepository:</p>
<pre name="code" class="java">public class CarRepository {
  private ServiceHeaderFactory serviceHeaderFactory;
  private CarService carService;

  public CarRepository(ServiceHeaderFactory serviceHeaderFactory,
                    CarService carService) {
    this.serviceHeaderFactory = serviceHeaderFactory;
    this.carService = carService;
  }
  public Cars findAll() {
    ServiceHeader serviceHeader = serviceHeaderFactory.create();
    return carService.findAll(serviceHeader);
  }
}</pre>
<p><strong><span style="text-decoration: underline;">Tautological Test</span></strong></p>
<p>The test below is similar to the one I wrote that we described as tautological:</p>
<pre name="code" class="java">@Test
public void shouldRetrieveCarsFromCarServiceUsingTheRightServiceHeader() throws Exception {
  // GIVEN
  ServiceHeader serviceHeader = new ServiceHeader();
  ServiceHeaderFactory serviceHeaderFactoryMock = mock(ServiceHeaderFactory.class);
  when(serviceHeaderFactoryMock.create()).thenReturn(serviceHeader);
  CarService carServiceMock = mock(CarService.class);
  CarRepository carRepository = new CarRepository(serviceHeaderFactoryMock, carServiceMock);

  // WHEN
  carRepository.findAll();

  // THEN
  verify(carServiceMock).findAll(serviceHeader);
}</pre>
<p><strong><span style="text-decoration: underline;">Why is this test called <em>Tautological</em>?</span></strong></p>
<p>One of the definitions of a tautology is: <em>“repetition of same sense in different words”</em></p>
<p>If you look carefully at these 2 lines of implementation and 2 lines of test:</p>
<p>Test</p>
<ul>
<li><strong>when(serviceHeaderFactoryMock.create()).thenReturn(serviceHeader);</strong></li>
<li><strong>verify(carServiceMock).findAll(serviceHeader);</strong></li>
</ul>
<p>Implementation</p>
<ul>
<li><strong>ServiceHeader serviceHeader = serviceHeaderFactory.create();</strong></li>
<li><strong>return carService.findAll(serviceHeader);</strong></li>
</ul>
<p>They are almost “equivalent”. When we write tests this way, most of the time if the implementation changes, we end up changing the expectations of the test as well and yeah, the tests pass <em>automagically</em>. But without knowing much about its <strong>behaviour</strong>. These tests are a mirror of the implementation, therefore tautological.</p>
<p>The test below verifies the same class CarRepository, but as a black box test, i.e. it does not test the interactions, but the <strong>output</strong> of the repository. Look at the assertion.</p>
<pre name="code" class="java">@Test
public void shouldBeAbleToRetrieveCars() throws Exception {
  // GIVEN
  Cars carsFromService = new Cars(new Car("Ferrari"), new Car("Porsche"));
  CarRepository carRepository = givenARepositoryAttachedToACarServiceWithCars(carsFromService);

  // WHEN
  Cars carsFromRepository = carRepository.findAll();

  // THEN
  Assert.assertEquals(carsFromService, carsFromRepository);
}

private CarRepository givenARepositoryAttachedToACarServiceWithCars(Cars carsFromService) {
  ServiceHeader serviceHeader = new ServiceHeader();
  ServiceHeaderFactory serviceHeaderFactoryMock = mock(ServiceHeaderFactory.class);
  when(serviceHeaderFactoryMock.create()).thenReturn(serviceHeader);
  CarService carServiceMock = mock(CarService.class);
  when(carServiceMock.findAll(serviceHeader)).thenReturn(carsFromService);
  CarRepository carRepository = new CarRepository(serviceHeaderFactoryMock, carServiceMock);
  return carRepository;
}</pre>
<p>There is still a big effort to setup the <a href="http://code.google.com/p/mockito/" target="_blank">mocks</a> and inject them into the repository. This has been extracted to the method <strong>givenARepositoryAttachedToACarServiceWithCars</strong>. However, all these mock setups make it harder to understand the intent of the test, the responsibility of the class that we are trying to test. When this happens I usually tend to use <a href="http://martinfowler.com/articles/mocksArentStubs.html" target="_blank">stubs instead of mocks</a>. Here is the same version of the tests, but using Stubs:</p>
<pre name="code" class="java">@Test
public void shouldBeAbleToRetrieveCars() throws Exception {
  // GIVEN
  Cars carsFromService = new Cars(new Car("Ferrari"), new Car("Porsche"));
  CarRepository carRepository = givenARepositoryAttachedToACarServiceWithCars(carsFromService);

  // WHEN
  Cars carsFromRepository = carRepository.findAll();

  // THEN
  Assert.assertEquals(carsFromService, carsFromRepository);
}

private CarRepository givenARepositoryAttachedToACarServiceWithCars(Cars carsFromService) {
  ServiceHeaderFactory serviceHeaderFactory = new ServiceHeaderFactoryStub();
  CarService carService = new CarServiceStub(carsFromService);
  CarRepository carRepository = new CarRepository(serviceHeaderFactory, carService);
  return carRepository;
}
</pre>
<p><a href="http://fabiopereira.me/files/TTDD.zip"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="download ttdd example" src="http://fabiopereira.me/img/downloadIcon.jpg" border="0" alt="download ttdd example" /> </p>
<div align="center">Download all the code from the example</div>
<p></a><br />
It is not a rule, but I find that tautological tests have more mock setup. When we start to think about the collaborators as stubs, the tests become more behavioural.</p>
<p><strong><span style="text-decoration: underline;">What are the common characteristics of a Tautological Test?</span></strong></p>
<ul>
<li>Asserts more interactions with collaborators than the outputs;</li>
<li>It doesn’t really test the behaviour of the class, but only its implementation</li>
<li>The test is too white box</li>
<li>Too much mock setup deviates the intent of the test</li>
<li>Adding a new feature or changing an existing one requires changing mock expectations</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://fabiopereira.me/blog/2010/05/27/ttdd-tautological-test-driven-development-anti-pattern/feed/</wfw:commentRss>
		</item>
		<item>
		<title>AFL Game - TW Sydney Social Club</title>
		<link>http://fabiopereira.me/blog/2010/05/22/afl-game-tw-sydney-social-club/</link>
		<comments>http://fabiopereira.me/blog/2010/05/22/afl-game-tw-sydney-social-club/#comments</comments>
		<pubDate>Sat, 22 May 2010 08:11:36 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<category><![CDATA[Fun]]></category>

		<category><![CDATA[SSC]]></category>

		<category><![CDATA[Sydney]]></category>

		<guid isPermaLink="false">http://fabiopereira.me/blog/2010/05/22/afl-game-tw-sydney-social-club/</guid>
		<description><![CDATA[ThoughtWorks Sydney Social Club (SSC) once again organised a very interesting event. We went to an AFL game at the Sydney Cricket Ground (SCG).
The game was Sydney Swans vs Fremantle. Of course we were supporting Sydney’s team Swans… But they lost… Even though the game was in Sydney and the stadium was 99% red and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.thoughtworks.com" target="_blank">ThoughtWorks</a> Sydney Social Club (SSC) once again organised a very interesting event. We went to an <a href="http://www.afl.com.au" target="_blank">AFL</a> game at the Sydney Cricket Ground (SCG).</p>
<p>The game was <strong>Sydney Swans</strong> vs <strong>Fremantle</strong>. Of course we were supporting Sydney’s team Swans… But <a href="http://www.afl.com.au/news/newsarticle/tabid/208/newsid/94804/default.aspx" target="_blank">they lost</a>… Even though the game was in Sydney and the stadium was 99% <strong><span style="color: #ff0000;">red</span></strong> and supporting them.</p>
<p>It was a great experience going to the SCG and catching up with some of my colleagues. These SSC events are perfect! <img src='http://fabiopereira.me/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p align="center"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="IMG_2024" src="http://fabiopereira.me/blog/wp-content/uploads/2010/05/img-2024.jpg" border="0" alt="IMG_2024" width="554" height="417" /></p>
<p align="center"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="IMG_2028" src="http://fabiopereira.me/blog/wp-content/uploads/2010/05/img-2028.jpg" border="0" alt="IMG_2028" width="554" height="417" /></p>
<p><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="IMG_2021" src="http://fabiopereira.me/blog/wp-content/uploads/2010/05/img-2021.jpg" border="0" alt="IMG_2021" width="554" height="417" /></p>
]]></content:encoded>
			<wfw:commentRss>http://fabiopereira.me/blog/2010/05/22/afl-game-tw-sydney-social-club/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Funny Story Wall Avatar</title>
		<link>http://fabiopereira.me/blog/2010/05/10/funny-story-wall-avatar/</link>
		<comments>http://fabiopereira.me/blog/2010/05/10/funny-story-wall-avatar/#comments</comments>
		<pubDate>Mon, 10 May 2010 07:47:42 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<category><![CDATA[AgileWall]]></category>

		<guid isPermaLink="false">http://fabiopereira.me/blog/2010/05/10/funny-story-wall-avatar/</guid>
		<description><![CDATA[No, I will not talk about James Cameron’s blue Jack and Rose new Titanic, aka Avatar.
“An avatar is a computer user&#8217;s representation of himself/herself or alter ego, as a two-dimensional icon (picture).
http://en.wikipedia.org/wiki/Avatar_(computing)
Usually on our agile projects, we like to put up walls with big visible charts and walls where we, and other stakeholders, can see [...]]]></description>
			<content:encoded><![CDATA[<p>No, I will not talk about <a href="http://www.imdb.com/title/tt0499549/" target="_blank">James Cameron’s blue Jack and Rose new Titanic, aka Avatar</a>.</p>
<p align="center"><em>“An <strong>avatar</strong> is a computer user&#8217;s representation of himself/herself or alter ego, as a two-dimensional icon </em><em>(picture).</em></p>
<p align="right"><a href="http://en.wikipedia.org/wiki/Avatar_(computing">http://en.wikipedia.org/wiki/Avatar_(computing)</a></p>
<p align="left">Usually on our <a href="http://agilemanifesto.org" target="_blank">agile projects</a>, we like to put up walls with <a href="http://xprogramming.com/articles/bigvisiblecharts/" target="_blank">big visible charts</a> and walls where we, and other stakeholders, can see what’s happening. One of the most commonly used types of wall is a <a href="http://www.google.com.au/images?q=agile%20story%20wall&amp;um=1&amp;ie=UTF-8&amp;source=og&amp;sa=N&amp;hl=en&amp;tab=wi" target="_blank">Story Wall</a>, where one of the messages that we try to convey is <strong>who is working on what</strong>…</p>
<p align="left">One of the ways of doing this is to stick the name or a photo of the person (or pair) who is working on a particular story. One of my life and work philosophies is that a hint of fun in almost everything very seldom hurts, on the other hand it brings a new and better atmosphere to the environment. So why not put a little bit of fun on the story wall?</p>
<p align="left">My current team:</p>
<p align="left"><a href="http://www.nigel.in/" target="_blank">Nigel Fernandes</a> had a goatee very similar to Ali G’s.</p>
<p align="left"><strong>Prabin Deka</strong> has been using a scarf indoor, which reminded us a little bit of the posh Jude Law.</p>
<p align="left"><strong>Ken Friesen</strong> is, obviously, Barbie’s husband.</p>
<p align="left">And why is this <a href="http://www.google.com.au/images?q=fabio&amp;um=1&amp;ie=UTF-8&amp;source=og&amp;sa=N&amp;hl=en&amp;tab=wi" target="_blank">Fabio</a> supermodel so famous? I get that all the time… Damn it. <img src='http://fabiopereira.me/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p align="center"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Funny Story Wall Avatar" src="http://fabiopereira.me/blog/wp-content/uploads/2010/05/funnystorywallavatar.jpg" border="0" alt="Funny Story Wall Avatar" width="375" height="500" /></p>
<p>Try to be creative and come up with your own Avatar Selection Criteria… <a href="http://fragmental.tw" target="_blank">Phillip</a> told once that he likes to Google for images with the person’s name and pick one from the first page… That’s a good one as well.</p>
<p>Anyway, the rule is to have a bit of fun.</p>
<p>Oh, I almost forgot the best Avatar on our project… <a href="http://lukestubbles.wordpress.com/" target="_blank">Luke Stubbles</a> got his name misspelled as Stubbies… And <a href="http://theinspirationroom.com/daily/commercials/2008/1/l&amp;p-stubbies.jpg" target="_blank">here is his photo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://fabiopereira.me/blog/2010/05/10/funny-story-wall-avatar/feed/</wfw:commentRss>
		</item>
		<item>
		<title>TW Scrum Attack &#8211; Volleyball Team at NSW Corporate Games</title>
		<link>http://fabiopereira.me/blog/2010/03/23/tw-scrum-attack-volleyball-team-at-nsw-corporate-games/</link>
		<comments>http://fabiopereira.me/blog/2010/03/23/tw-scrum-attack-volleyball-team-at-nsw-corporate-games/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 12:21:11 +0000</pubDate>
		<dc:creator>Fabio Pereira</dc:creator>
		
		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://fabiopereira.me/blog/2010/03/23/tw-scrum-attack-volleyball-team-at-nsw-corporate-games/</guid>
		<description><![CDATA[Last weekend we played volleyball in Manly-Sydney at the NSW Corporate Games. We gathered a team of thoughtworkers called Scrum Attack.
Juliano Bersano, Benjamin Barnard, Pei Ren Tan, Shelley Beeston, Duana Stanley, Charlotte Chang and me!  
Our captain Juliano Bersano described the games pretty well:
“It was indeed a pretty fun Saturday, with two losses followed [...]]]></description>
			<content:encoded><![CDATA[<p>Last weekend we played volleyball in Manly-Sydney at the <a href="http://corporategames.net.au/nsw/" target="_blank">NSW Corporate Games</a>. We gathered a team of thoughtworkers called Scrum Attack.</p>
<p>Juliano Bersano, Benjamin Barnard, Pei Ren Tan, Shelley Beeston, Duana Stanley, Charlotte Chang and me! <img src='http://fabiopereira.me/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Our captain <a href="http://twitter.com/julianobersano" target="_blank">Juliano Bersano</a> described the games pretty well:</p>
<p><em>“It was indeed a pretty fun Saturday, with <strong>two losses</strong> followed by <strong>two wins</strong>, Scrum Attack does have an issue with getting points in the first iterations, then our velocity goes up. Next time we&#8217;re starting with two friendlies at 6am and then it&#8217;s guaranteed we will be through!”</em></p>
<p>Thanks everyone, it was a great Saturday. Let’s do it again.</p>
<p>All photos are <a href="http://picasaweb.google.com/fabiopereira.me/NswCorporateGamesManlyVolleyballVolleyThoughworksTw#" target="_blank">here</a>.</p>
<p align="center"><a href="http://picasaweb.google.com/fabiopereira.me/NswCorporateGamesManlyVolleyballVolleyThoughworksTw#" target="_blank"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="nsw corporate games manly volleyball volley thoughworks tw" src="http://fabiopereira.me/blog/wp-content/uploads/2010/03/nswcorporategamesmanlyvolleyballvolleythoughworkstw.jpg" border="0" alt="nsw corporate games manly volleyball volley thoughworks tw" width="450" height="409" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://fabiopereira.me/blog/2010/03/23/tw-scrum-attack-volleyball-team-at-nsw-corporate-games/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
