<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Getting Agile &#187; Java</title>
	<atom:link href="http://www.gettingagile.com/category/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gettingagile.com</link>
	<description>with Sterling Barton</description>
	<lastBuildDate>Mon, 14 Jun 2010 18:18:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Extreme Feedback from My Tools &#8211; Part 1: Maven 2 Configuration</title>
		<link>http://www.gettingagile.com/2009/12/11/extreme-feedback-from-my-tools-part-1-maven-2-configuration/</link>
		<comments>http://www.gettingagile.com/2009/12/11/extreme-feedback-from-my-tools-part-1-maven-2-configuration/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 02:53:34 +0000</pubDate>
		<dc:creator>Chris Sterling</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://www.gettingagile.com/?p=354</guid>
		<description><![CDATA[
For many years now, it has been a goal of mine to get feedback as early as possible when developing software. Past blog entries here and here have discussed how we can approach increased feedback. A tweet from Jason Gorman mentioned his list of tools that provide continuous feedback on his code and design: &#8220;Emma, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><span><span><img class="aligncenter size-medium wp-image-358" style="float: left;" title="Feedback" src="http://www.gettingagile.com/wp-content/uploads/2009/12/Feedback-300x300.jpg" alt="Feedback" width="180" height="180" /></span></span></p>
<p>For many years now, it has been a goal of mine to get feedback as early as possible when developing software. Past blog entries <a href="http://www.gettingagile.com/2007/11/13/running-all-unit-tests-when-saving-a-file-in-eclipse/" target="_blank">here</a> and <a href="http://www.gettingagile.com/2008/12/13/executable-design-a-new-name-for-tdd/" target="_blank">here</a> have discussed how we can approach increased feedback. A tweet from <a href="http://twitter.com/jasongorman/" target="_blank">Jason Gorman</a> mentioned his list of tools that provide continuous feedback on his code and design: <span><span>&#8220;Emma, Jester, XDepend, Checkstyle and Simian&#8221;. This inspired me to write a post on how I approach setting up project reporting and my IDE to provide increased feedback. This article will be the first part of a series on &#8220;Extreme Feedback from My Tools&#8221; and will focus on Maven 2 configuration and reporting.<br />
</span></span></p>
<p style="text-align: center;"><span><span><img class="aligncenter" title="Build by Maven" src="http://maven.apache.org/images/logos/maven-feather.png" alt="" width="90" height="30" /><br />
</span></span></p>
<p><span><span>Maven is my tool of choice for managing builds, versioning, deployment, and test execution. Although, it wouldn&#8217;t hurt my feelings if teams I worked on used Ant, make, or other scripting methods to manage these, but it tends to be more difficult overall. For those who are alright with using Maven, here is a look at different aspects of a typical POM file configuration I use:</span></span></p>
<pre class="code">&lt;build&gt;
  &lt;plugins&gt;
    &lt;plugin&gt;
      &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
      &lt;configuration&gt;
        &lt;source&gt;1.5&lt;/source&gt;
        &lt;target&gt;1.5&lt;/target&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.4.2&lt;/version&gt;
      &lt;configuration&gt;
        &lt;includes&gt;
          &lt;include&gt;**/When*.java&lt;/include&gt;
        &lt;/includes&gt;
        &lt;redirectTestOutputToFile&gt;true&lt;/redirectTestOutputToFile&gt;
        &lt;trimStackTrace&gt;false&lt;/trimStackTrace&gt;
        &lt;useSystemClassLoader&gt;false&lt;/useSystemClassLoader&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
  &lt;/plugins&gt;
&lt;/build&gt;</pre>
<p><span>The above portion of the POM file are configurations for all Maven execution scenarios for this project. The first plugin, &#8220;maven-compiler-plugin&#8221;, sets the expected source code compliance and the JVM version that the compiled binary will target. The &#8220;maven-surefire-plugin&#8221; executes tests such as those developed with JUnit and TestNG. Because my approach is to take a more BDD-like naming convention and style for test cases, this POM is configured to execute unit tests that start with the word &#8220;When&#8221; in the test source code directory, by default this is &#8220;src/test/java&#8221;. Having the full stack trace from test execution issues is essential to effective debugging of the automated build and tests, therefore the configuration makes sure that they are not trimmed in the output file. Finally, some code that I have created in the recent past needed to find classes on the Maven classpath and through much debugging I found out that the system class loader was used by default with surefire so I now make sure to set it up to use the Maven class loader instead.<br />
</span></p>
<pre class="code">&lt;reporting&gt;
  &lt;plugins&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
      &lt;artifactId&gt;maven-pmd-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.3&lt;/version&gt;
      &lt;configuration&gt;
        &lt;linkXref&gt;true&lt;/linkXref&gt;
        &lt;targetJdk&gt;1.5&lt;/targetJdk&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;cobertura-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.4&lt;/version&gt;
      &lt;configuration&gt;
        &lt;formats&gt;
          &lt;format&gt;html&lt;/format&gt;
          &lt;format&gt;xml&lt;/format&gt;
        &lt;/formats&gt;
      &lt;/configuration&gt;
    &lt;/plugin&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;jdepend-maven-plugin&lt;/artifactId&gt;
    &lt;/plugin&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;dashboard-maven-plugin&lt;/artifactId&gt;
    &lt;/plugin&gt;
    &lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;findbugs-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;2.2&lt;/version&gt;
    &lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/reporting&gt;</pre>
<p><span>Reports are effective at giving the team indicators of potential problems in their project artifacts early. Teams tend to find that trends are more valuable then specific targets in the generated reports. If the code coverage is going down we ask ourselves &#8220;why?&#8221;. If more defects are being detected by source code analysis tools then we can look at how we can change our approach to reduce the frequency of these issues. The 5 plugins used in this POM report on different perspectives of the software artifacts and can help to find problematic trends early.</span></p>
<ul>
<li><span><a href="http://pmd.sourceforge.net/" target="_blank">PMD</a> is for source code analysis<br />
</span></li>
<li><span><a href="http://cobertura.sourceforge.net/" target="_blank">Cobertura</a> is for code coverage</span></li>
<li><span><a href="http://clarkware.com/software/JDepend.html" target="_blank">JDepend</a> is a package dependency analyzer<br />
</span></li>
<li><span><a href="http://findbugs.sourceforge.net/" target="_blank">FindBugs</a> detects bugs in code</span></li>
<li><span>The <a href="http://mojo.codehaus.org/dashboard-maven-plugin/" target="_blank">dashboard plugin</a> shows the results of the reports in a single view</span></li>
</ul>
<p>When the continuous integration server successfully executes the build and automated tests, the Maven reporting command is executed to generate these reports. This happens automatically and is shown on our video monitor &#8220;information radiator&#8221; in the team area.</p>
<pre class="code">&lt;dependencies&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;junit&lt;/groupId&gt;
    &lt;artifactId&gt;junit&lt;/artifactId&gt;
    &lt;version&gt;4.7&lt;/version&gt;
    &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;org.mockito&lt;/groupId&gt;
    &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
    &lt;version&gt;1.8.0&lt;/version&gt;
  &lt;/dependency&gt;
&lt;/dependencies&gt;</pre>
<p><span>We make sure to update the POM to use <a href="http://www.junit.org/" target="_blank">JUnit 4</a> so that our team can use annotations and better names for the tests. Also, <a href="http://mockito.org/" target="_blank">Mockito</a> has become my favorite mock objects framework since it stays away from the &#8220;replay&#8221; confusion of other mock frameworks (or their old versions at least) and also has a <a href="http://mockito.googlecode.com/svn/branches/1.8.0/javadoc/org/mockito/BDDMockito.html" target="_blank">BDDMockito</a> class that enables our team to use the given/when/then construction for our tests.</span></p>
<p><span>Once your POM file is configured with these reporting plugins, you can generate the reports by executing the &#8217;site&#8217; life cycle in Maven:</span></p>
<pre class="code">
mvn site
</pre>
<p><span>Part 2 of this series of articles will discuss configuration of an Eclipse IDE environment for Extreme Feedback.<br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingagile.com/2009/12/11/extreme-feedback-from-my-tools-part-1-maven-2-configuration/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Slides from Managing Software Debt Talk at PNSQC 2009</title>
		<link>http://www.gettingagile.com/2009/10/27/slides-from-managing-software-debt-talk-at-pnsqc-2009/</link>
		<comments>http://www.gettingagile.com/2009/10/27/slides-from-managing-software-debt-talk-at-pnsqc-2009/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 22:00:28 +0000</pubDate>
		<dc:creator>Chris Sterling</dc:creator>
				<category><![CDATA[Acceptance Testing]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Conferences]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Leadership]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Product Owner]]></category>
		<category><![CDATA[Scrum]]></category>
		<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[User Stories]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://www.gettingagile.com/?p=316</guid>
		<description><![CDATA[Tomorrow at 1:30pm I will be discussing my paper published by the Pacific Northwest Software Quality Conference 2009 in Portland, OR on &#8220;Managing Software Debt: Continued Delivery of High Value as Systems Age&#8221;. I have uploaded the slides for this presentation and I hope that some of the new content will help those looking for [...]]]></description>
			<content:encoded><![CDATA[<p>Tomorrow at 1:30pm I will be discussing my paper published by the Pacific Northwest Software Quality Conference 2009 in Portland, OR on &#8220;Managing Software Debt: Continued Delivery of High Value as Systems Age&#8221;. I have uploaded the slides for this presentation and I hope that some of the new content will help those looking for ways to manage their software debt more effectively in 5 key areas:</p>
<ul>
<li>Technical debt: tends to focused on the code and reveals itself in duplication and code smells</li>
<li>Quality debt: focuses on QA aspects of software development and shows up in growing bug databases and longer regression test runs</li>
<li>Configuration Management debt: focuses on integration and release management aspects and becomes apparent with extreme branching and inability to recreate environments from scratch</li>
<li>Design debt: focuses on design constructs of components within an application or enterprise infrastructure and is usually difficult to figure out until you are close to a deadline such handling production load</li>
<li>Platform Experience debt: focuses on the people in the software creation process and usually involves extreme specialization and waiting on people to finish their part</li>
</ul>
<p>Without further ado, here are the slides:</p>
<div id="__ss_2357272" style="width: 425px; text-align: left;"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" title="Managing Software Debt - PNSQC 2009" href="http://www.slideshare.net/csterwa/managing-software-debt-pnsqc-2009">Managing Software Debt &#8211; PNSQC 2009</a><object style="margin:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=managingsoftwaredebt-pnsqc2009-091027083353-phpapp02&amp;stripped_title=managing-software-debt-pnsqc-2009" /><param name="allowfullscreen" value="true" /><embed style="margin:0px" type="application/x-shockwave-flash" width="425" height="355" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=managingsoftwaredebt-pnsqc2009-091027083353-phpapp02&amp;stripped_title=managing-software-debt-pnsqc-2009" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="font-size: 11px; font-family: tahoma,arial; height: 26px; padding-top: 2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/csterwa">Chris Sterling</a>.</div>
</div>
<p>Also, here is the picture I use to discuss Managing Software Debt from high level in terms of maintaining and enhancing value of software assets:</p>
<p><a href="http://chrissterling.gettingagile.com/wp-content/uploads/2008/10/effectrefactoringtopreserveswvalue.jpg"><img title="Effect of Managing Software Debt to Preserve Software Value" src="http://chrissterling.gettingagile.com/wp-content/uploads/2008/10/effectrefactoringtopreserveswvalue-300x181.jpg" alt="Effect of Managing Software Debt to Preserve Software Value" width="300" height="181" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingagile.com/2009/10/27/slides-from-managing-software-debt-talk-at-pnsqc-2009/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Executable Specifications &#8211; Presentation from AgilePalooza</title>
		<link>http://www.gettingagile.com/2009/08/06/executable-specifications-presentation-from-agilepalooza/</link>
		<comments>http://www.gettingagile.com/2009/08/06/executable-specifications-presentation-from-agilepalooza/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 13:48:41 +0000</pubDate>
		<dc:creator>Chris Sterling</dc:creator>
				<category><![CDATA[Acceptance Testing]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Scrum]]></category>
		<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[User Stories]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://chrissterling.gettingagile.com/?p=296</guid>
		<description><![CDATA[Earlier this year I did a presentation on Executable Specficiations for AgilePalooza conference. There is information about working with legacy code, commercial off-the-shelf (COTS) systems, and Acceptance Test-Driven Development (ATDD) using automated acceptance testing tools. Also, the presentation lists types of automated acceptance testing tools out there along with actual names of tools and what [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this year I did a presentation on Executable Specficiations for AgilePalooza conference. There is information about working with legacy code, commercial off-the-shelf (COTS) systems, and Acceptance Test-Driven Development (ATDD) using automated acceptance testing tools. Also, the presentation lists types of automated acceptance testing tools out there along with actual names of tools and what they are best used for on projects. Hope it is interesting to you.</p>
<div style="width:425px;text-align:left" id="__ss_1499430"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/csterwa/executable-specifications-agile-palooza" title="Executable Specifications Agile Palooza">Executable Specifications Agile Palooza</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=executablespecifications-agilepalooza-090528014316-phpapp01&#038;stripped_title=executable-specifications-agile-palooza" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=executablespecifications-agilepalooza-090528014316-phpapp01&#038;stripped_title=executable-specifications-agile-palooza" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">documents</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/csterwa">Chris Sterling</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingagile.com/2009/08/06/executable-specifications-presentation-from-agilepalooza/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Designing Through Programmer Tests (TDD)</title>
		<link>http://www.gettingagile.com/2009/05/27/designing-through-programmer-tests-tdd/</link>
		<comments>http://www.gettingagile.com/2009/05/27/designing-through-programmer-tests-tdd/#comments</comments>
		<pubDate>Wed, 27 May 2009 19:47:53 +0000</pubDate>
		<dc:creator>Chris Sterling</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Scrum]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://chrissterling.gettingagile.com/?p=227</guid>
		<description><![CDATA[To reduce duplication and rigidity of the programmer test relationship to implementation code, move away from class and methods as the definition of a “unit” in your unit tests. Instead, use the following question to drive your next constraint on the software:
What should the software do next for the user?
The following coding session will provide [...]]]></description>
			<content:encoded><![CDATA[<p>To reduce duplication and rigidity of the programmer test relationship to implementation code, move away from class and methods as the definition of a “unit” in your unit tests. Instead, use the following question to drive your next constraint on the software:</p>
<blockquote><p><em><strong>What should the software do next for the user?</strong></em></p></blockquote>
<p>The following coding session will provide an example of applying this question. The fictitious application is a micro-blogging tool named “Jitter”. This is a Seattle-based fictitious company that focuses on enabling coffee injected folks write short messages and have common online messaging shorthand to be expanded for easy reading. The user story we are working on is:</p>
<blockquote><p><strong>So that it is easier to keep up with my kid’s messages, Mothers want to automatically expand their kid’s shorthand</strong></p></blockquote>
<p>The acceptance criteria for this user story are:</p>
<ul>
<li>LOL, AFAIK, and TTYL are expandable</li>
<li>Able to expand lower and upper case versions of shorthand</li>
</ul>
<p>The existing code already includes a JitterSession class that users obtain when they authenticate into Jitter to see messages from other people they are following. Mothers can follow their children in this application and so will see their messages in the list of new messages. The client application will automatically expand all of the messages written in shorthand.</p>
<p>The following programmer test expects to expand LOL to “laughing out loud” inside the next message in the JitterSession.</p>
<pre style="overflow:auto;width:95%;padding:2px;background-color:lightgray;border-style:dashed;border-width:1px">
public class WhenUsersWantToExpandMessagesThatContainShorthandTest {

    @Test
    public void shouldExpandLOLToLaughingOutLoud() {
        JitterSession session = mock(JitterSession.class);
        when(session.getNextMessage()).thenReturn("Expand LOL please");
        MessageExpander expander = new MessageExpander(session);
        assertThat(expander.getNextMessage(), equalTo("Expand laughing out loud please"));
    }

}
</pre>
<p>The MessageExpander class did not exist so along the way I created a skeleton of this class to make the code compile. Once the assertion is failing, I then make the test pass with the following implementation code inside the MessageExpander class:</p>
<pre style="overflow:auto;width:95%;padding:2px;background-color:lightgray;border-style:dashed;border-width:1px">
public String getNextMessage() {
    String msg = session.getNextMessage();
    return msg.replaceAll("LOL", "laughing out loud");
}
</pre>
<p>This is the most basic message expansion I could do for only one instance of shorthand text. I notice that there are different variations of the message that I want to handle. What if LOL is written in lower case? What if it is written as “Lol”? Should it be expanded? Also, what if some variation of LOL is inside a word? It probably should not expand the shorthand in that case except if the characters surrounding it are symbols, not letters. I write all of this down in the programmer test as comments so I don’t forget about all of these.</p>
<pre style="overflow:auto;width:95%;padding:2px;background-color:lightgray;border-style:dashed;border-width:1px">
// shouldExpandLOLIfLowerCase
// shouldNotExpandLOLIfMixedCase
// shouldNotExpandLOLIfInsideWord
// shouldExpandIfSurroundingCharactersAreNotLetters
</pre>
<p>I then start working through this list of test cases to enhance the message expansion capabilities in Jitter.</p>
<pre style="overflow:auto;width:95%;padding:2px;background-color:lightgray;border-style:dashed;border-width:1px">
@Test
public void shouldExpandLOLIfLowerCase() {
    when(session.getNextMessage()).thenReturn("Expand lol please");
    MessageExpander expander = new MessageExpander(session);
    assertThat(expander.getNextMessage(), equalTo("Expand laughing out loud please"));
}
</pre>
<p>This forced me to use the java.util.regex.Pattern class to handle case insensitivity.</p>
<pre style="overflow:auto;width:95%;padding:2px;background-color:lightgray;border-style:dashed;border-width:1px">
public String getNextMessage() {
    String msg = session.getNextMessage();
    return Pattern.compile("LOL", Pattern.CASE_INSENSITIVE).matcher(msg).replaceAll("laughing out loud");
}
</pre>
<p>Now make it so mixed case versions of LOL are not expanded.</p>
<pre style="overflow:auto;width:95%;padding:2px;background-color:lightgray;border-style:dashed;border-width:1px">
@Test
public void shouldNotExpandLOLIfMixedCase() {
    String msg = "Do not expand Lol please";
    when(session.getNextMessage()).thenReturn(msg);
    MessageExpander expander = new MessageExpander(session);
    assertThat(expander.getNextMessage(), equalTo(msg));
}
</pre>
<p>This forced me to stop using the Pattern.CASE_INSENSITIVE flag in the pattern compilation. Instead I tell it to match only “LOL” or “lol” for replacement.</p>
<pre style="overflow:auto;width:95%;padding:2px;background-color:lightgray;border-style:dashed;border-width:1px">
public String getNextMessage() {
    String msg = session.getNextMessage();
    return Pattern.compile("LOL|lol").matcher(msg).replaceAll("laughing out loud");
}
</pre>
<p>Next we’ll make sure that if LOL is inside a word it is not expanded.</p>
<pre style="overflow:auto;width:95%;padding:2px;background-color:lightgray;border-style:dashed;border-width:1px">
@Test
public void shouldNotExpandLOLIfInsideWord() {
    String msg = "Do not expand PLOL or LOLP or PLOLP please";
    when(session.getNextMessage()).thenReturn(msg);
    MessageExpander expander = new MessageExpander(session);
    assertThat(expander.getNextMessage(), equalTo(msg));
}
</pre>
<p>The pattern matching is now modified to use spaces around each variation of valid LOL shorthand.</p>
<pre style="overflow:auto;width:95%;padding:2px;background-color:lightgray;border-style:dashed;border-width:1px">
return Pattern.compile("\\sLOL\\s|\\slol\\s").matcher(msg).replaceAll("laughing out loud");
</pre>
<p>Finally, it is important that if the characters around LOL are not letters it still expands.</p>
<pre style="overflow:auto;width:95%;padding:2px;background-color:lightgray;border-style:dashed;border-width:1px">
@Test
public void shouldExpandIfSurroundingCharactersAreNotLetters() {
    when(session.getNextMessage()).thenReturn("Expand .lol! please");
    MessageExpander expander = new MessageExpander(session);
    assertThat(expander.getNextMessage(), equalTo("Expand .laughing out loud! please"));
}
</pre>
<p>The final implementation of the pattern matching code looks as follows.</p>
<pre style="overflow:auto;width:95%;padding:2px;background-color:lightgray;border-style:dashed;border-width:1px">
return Pattern.compile("\\bLOL\\b|\\blol\\b").matcher(msg).replaceAll("laughing out loud");
</pre>
<p>I will defer refactoring this implementation until I have to expand additional instances of shorthand text. It just so happens that our acceptance criterion for the user story asks that AFAIK and TTYL are expanded, as well. I won’t show the code for the other shorthand variations in the acceptance criteria. However, I do want to discuss how the focus on “what should the software do next” drove the design of this small component.</p>
<p>Driving the software development using TDD focusing on what the software should do next helps guide us to only implement what is needed and with 100% programmer test coverage for all lines of code. For those who have some experience with object-oriented programming will implement the code with high cohesion, modules focused on specific responsibilities, and low coupling, modules that make few assumptions about other module they interact with will do. This is supported by the disciplined application of TDD. The failing programmer test represents something that the software does not do yet. We focus on modifying the software with the simplest implementation that will make the programmer test pass. Then we focus on enhancing the software’s design with the refactoring step. It has been my experience that refactoring refactoring represents most of the effort expended when doing TDD effectively.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingagile.com/2009/05/27/designing-through-programmer-tests-tdd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Talk @ SD West 2009 on &quot;Managing Software Debt&quot;</title>
		<link>http://www.gettingagile.com/2009/03/27/my-talk-sd-west-2009-on-managing-software-debt/</link>
		<comments>http://www.gettingagile.com/2009/03/27/my-talk-sd-west-2009-on-managing-software-debt/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 20:55:12 +0000</pubDate>
		<dc:creator>Chris Sterling</dc:creator>
				<category><![CDATA[Acceptance Testing]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Distributed Computing]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[IASA]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Jini/JavaSpaces]]></category>
		<category><![CDATA[Leadership]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Podcasts]]></category>
		<category><![CDATA[Product Owner]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Scrum]]></category>
		<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[User Stories]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://chrissterling.gettingagile.com/?p=237</guid>
		<description><![CDATA[I have uploaded the talk I did at SD West 2009 on Yahoo! Video and here it is:
Managing Software Debt &#8211; Chris Sterling @ SD West 2009 @ Yahoo! Video
]]></description>
			<content:encoded><![CDATA[<p>I have uploaded the talk I did at SD West 2009 on Yahoo! Video and here it is:</p>
<div><object width="512" height="322"><param name="movie" value="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40" /><param name="allowFullScreen" value="true" /><param name="AllowScriptAccess" VALUE="always" /><param name="bgcolor" value="#000000" /><param name="flashVars" value="id=12699073&#038;vid=4754803&#038;lang=en-us&#038;intl=us&#038;thumbUrl=http%3A//l.yimg.com/a/p/i/bcst/videosearch/8055/82632771.jpeg&#038;embed=1" /><embed src="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40" type="application/x-shockwave-flash" width="512" height="322" allowFullScreen="true" AllowScriptAccess="always" bgcolor="#000000" flashVars="id=12699073&#038;vid=4754803&#038;lang=en-us&#038;intl=us&#038;thumbUrl=http%3A//l.yimg.com/a/p/i/bcst/videosearch/8055/82632771.jpeg&#038;embed=1" ></embed></object><br /><a href="http://video.yahoo.com/watch/4754803/12699073">Managing Software Debt &#8211; Chris Sterling @ SD West 2009</a> @ <a href="http://video.yahoo.com" >Yahoo! Video</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingagile.com/2009/03/27/my-talk-sd-west-2009-on-managing-software-debt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Top 25 Open Source Projects &#8212; Recommended for Enterprise Use</title>
		<link>http://www.gettingagile.com/2008/12/17/top-25-open-source-projects-recommended-for-enterprise-use/</link>
		<comments>http://www.gettingagile.com/2008/12/17/top-25-open-source-projects-recommended-for-enterprise-use/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 20:44:20 +0000</pubDate>
		<dc:creator>Chris Sterling</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Distributed Computing]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Software Architecture]]></category>

		<guid isPermaLink="false">http://chrissterling.gettingagile.com/2008/12/17/top-25-open-source-projects-recommended-for-enterprise-use/</guid>
		<description><![CDATA[This is a bit off my usual topics on this blog but I am a heavy open source user and this article is something that I hope gets to more enterprise operations, managers and executives. I have been using and deploying production available applications using open source tools, libraries, and platforms for over 12 years [...]]]></description>
			<content:encoded><![CDATA[<p>This is a bit off my usual topics on this blog but I am a heavy open source user and <a target="_blank" href="http://www.palamida.com/blogs/25-hot-open-source-projects-organizations-should-be-using-today">this article</a> is something that I hope gets to more enterprise operations, managers and executives. I have been using and deploying production available applications using open source tools, libraries, and platforms for over 12 years now. Open source tools can do almost anything commercial products are able to do and have transformed the software industry in that time span. The list given in the article contains open source projects that I would recommend and have used in the past either directly or indirectly including *nix tools and libraries shown.</p>
<p>I would like to add to this listing with some of the tools I have come to use often:
<ul>
<li>Maven 2.x+ (http://maven.apache.org/)</li>
<li>JBoss (http://www.jboss.org/)</li>
<li>Rio/Jini/Apache River (http://incubator.apache.org/river/RIVER/index.html)</li>
<li>Apache Commons (http://commons.apache.org/)</li>
<li>Subversion (http://subversion.tigris.org/)</li>
<li>Apache Web Server (http://httpd.apache.org/)</li>
<li>Bouncy Castle (http://www.bouncycastle.org/)</li>
<li>Time and Money (http://timeandmoney.sourceforge.net/)</li>
<li>Spring Framework (http://www.springframework.org/)</li>
<li>Hadoop (http://hadoop.apache.org/)</li>
<li>Ruby on Rails (http://www.rubyonrails.org/)</li>
</ul>
<p>This is some of the open source that I have and still use on my projects. What are your favorites that were not on the list?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingagile.com/2008/12/17/top-25-open-source-projects-recommended-for-enterprise-use/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Executable Design &#8212; A New Name for TDD?</title>
		<link>http://www.gettingagile.com/2008/12/13/executable-design-a-new-name-for-tdd/</link>
		<comments>http://www.gettingagile.com/2008/12/13/executable-design-a-new-name-for-tdd/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 22:24:48 +0000</pubDate>
		<dc:creator>Chris Sterling</dc:creator>
				<category><![CDATA[Acceptance Testing]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Scrum]]></category>
		<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://chrissterling.gettingagile.com/?p=181</guid>
		<description><![CDATA[For multiple years now I have thrown around the name &#8220;Executable Design&#8221; to describe Test-Driven Development (TDD) and how it is used for design rather than a test-centric tool. The name itself causes problems for those who are initially introduced to the technique. As a coach I was looking for a way to introduce it [...]]]></description>
			<content:encoded><![CDATA[<p>For multiple years now I have thrown around the name &#8220;Executable Design&#8221; to describe Test-Driven Development (TDD) and how it is used for design rather than a test-centric tool. The name itself causes problems for those who are initially introduced to the technique. As a coach I was looking for a way to introduce it without stereotyping it as extra tests inhibiting more code getting delivered.</p>
<p>From my readings of multiple books, articles, and blog postings along with my own experiences with TDD the content of what I am about to distill is not new. This post is entirely about explaining the technique in a way that garners interest quickly. There are multiple pieces to &#8220;Executable Design&#8221; beyond the basic process of:</p>
<ul>
<li><em>Red, Green, Refactor or</em></li>
<li><em>Write Test, Write Code, Refactor</em></li>
</ul>
<p>These statements and the technique is the basis for practicing Executable Design but are not sufficient for describing the value and nuance of the practice. Not that I will be able to present it sufficiently in a single blog post but I want to present the basic principles.</p>
<p>While in a meeting with a team recently we were presented with a question I have heard often:</p>
<p><em>&#8220;Why should we use TDD?&#8221;</em></p>
<p>There are many reasons but generic reasoning alone is not sufficient. We discussed the safety net that good code coverage creates. We discussed the reason system tests do not take the place of unit tests. Then we started to touch on design and this is where it got interesting (and usually it does about this time for me). Before I can describe the rest of this discussion I want to present what lead up to this meeting.</p>
<p>A coach that I highly respect seemed a bit preoccupied one day when he wandered into my team&#8217;s area. I asked him what was going on and he told me that some of his issues with the current team he was coaching. He wondered why they were not consistently using TDD in their day-to-day development. The team had allowed a card saying &#8220;We do TDD&#8221; onto their <a title="Creating a Team Working Agreement" href="http://chrissterling.gettingagile.com/2008/05/02/creating-a-team-working-agreement/">Working Agreement</a> and were not adhering to it.</p>
<p>I happened to know a bit about the background of this project that our company has been working on for over 2 1/2 years. There is a significant legacy codebase developed over many more years with poor design, multiple open source libraries included, and heavy logic built into relational database stored procedures. Also, just recently management on the client&#8217;s side had changed significantly and caused quite a shake up in terms of their participation and guidance of release deliverables. Yet the team was supposed to deliver on a date with certain features that were not well defined. This lead me to discuss the following situations that a coach can find their way into:</p>
<ol>
<li>You could come into a team that has limited pressure on features and schedule and has considered the impact of learning a new technique such as Executable Design. Also, they have asked for a coach to help them implement Executable Design effectively. This is a highly successful situation for a coach to enter.</li>
<li>You could come into a team that has deadline pressures but has some leeway on features or vise versa and has considered the impact of learning a new technique such as Executable Design within their current release. Also, they have asked for a coach to help them implement Executable Design effectively. This is somewhat successful but pressures of the release rise and fall in this situation and may impact the effectiveness of the coaching.</li>
<li>You could come into a team that has deadline pressures and has not considered implementing Executable Design seriously as a team. Also, they have NOT asked for a coach and yet they have gotten one. The coach and the techniques they are attempting to help the team implement may seem like a distraction to the team&#8217;s real work of delivering a release. This is usually not successful and please let me know if you are a person who is somewhat successful in this situation because we could hire you.</li>
</ol>
<p>The current team situation seemed to be more like #3 above and therefore the lack of success in helping the team adopt TDD did not surprise me. Also, I started to play devil&#8217;s advocate and provide a list of reasons for this team NOT to do TDD:</p>
<ul>
<li>At current velocity the team is just barely going to make their release date with the minimum feature set</li>
<li>Not enough people on the team know how to do TDD well enough to continue it&#8217;s use without the coach</li>
<li>The architecture of the system is poor since most logic is captured in Java Server Pages (JSP) and stored procedures</li>
<li>The code base is large and contains only about 5-10% test coverage at this time</li>
<li>It sometimes takes 10 times longer to do TDD than just add functionality desired by customer</li>
</ul>
<p>This is not the full list but you get the picture. Don&#8217;t get me wrong, the list above begs to me the need for Executable Design but if the team does not have significant experience to implement it effectively it could seem overhead with little benefit to show for it.</p>
<p>After discussing this and more stuff that I won&#8217;t go into he told me about a couple of things that he can do to help the team. One of them was to work on minimizing the reasons for not doing Executable Design by discussing them with their ScrumMaster and actioning them on the impediments list. Some of those actions would go to upper management who get together each day and resolve impediments at an organizational level. One of the actions was to get our CTO and myself into a room with the team so they can ask the question &#8220;why should we do TDD?&#8221;.</p>
<p>Now we are in the room and most of the team members had been exposed to TDD through pairing sessions. Some of them had some ideas about where TDD was useful and why they thought it was not on this project. During the discussion one of the team members brought up a great discussion point:</p>
<p><em>&#8220;One of the problems with our use of TDD is that we are not using it for improving the design. If we just create unit tests to test the way the code is structured right now it will not do any good. In fact, it seems like we are wasting time putting in unit tests and system tests since they are not helping us implement new functionality faster.&#8221;</em></p>
<p>This team member had just said in the first sentence what I instinctually think when approaching a code base. The reason to do TDD is not just to create code coverage but to force design improvement as the code is being written. This is why I call TDD and its best known principles and practices of applying it Executable Design. If you are not improving the design of the application then you are not doing Executable Design. You might be just adding tests.</p>
<p>Some of the principles I have found to help me in applying Executable Design effectively are (and most, if not all, of these are not something I came up with):</p>
<ul>
<li>Don&#8217;t write implementation code for your application without a failing unit test</li>
<li>Separate unit tests from system and persistence tests. (as described in this <a title="Managing Unit and Acceptance Tests Effectively" href="http://chrissterling.gettingagile.com/2007/07/23/managing-unit-and-acceptance-tests-effectively/">previous blog entry</a>)</li>
<li>Create interfaces with integration points in a need-driven way (as described in this <a title="Need-Driven Design as an Integration Strategy" href="http://chrissterling.gettingagile.com/2006/09/25/need-driven-design-as-an-integration-strategy/">previous blog entry</a>)</li>
<li>Always start implementing from the outside in (such as in <a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development">Behavior-Driven Development</a> and as described in this <a title="Defining the Unit in Unit Testing" href="http://chrissterling.gettingagile.com/2008/09/27/defining-the-unit-in-unit-testing/">previous blog entry</a>)</li>
<li>Mercilessly refactor the code you are working on to an acceptable design (the limits of which are described in this <a title="Refactoring: How Far Should I Go?" href="http://chrissterling.gettingagile.com/2008/10/13/refactoring-how-far-should-i-go/">previous blog entry</a>)</li>
<li>Execute your full &#8220;unit test&#8221; suite as often as possible (as described in this <a title="Running All Unit Tests When Saving a File in Eclipse" href="http://chrissterling.gettingagile.com/2007/11/13/running-all-unit-tests-when-saving-a-file-in-eclipse/">previous blog entry</a>)</li>
<li>Use the &#8220;campground rules&#8221; of working in the code: <em>&#8220;Leave the site in better shape than when you arrived&#8221;</em></li>
<li>Create a <a title="Creating a Team Working Agreement" href="http://chrissterling.gettingagile.com/2008/05/02/creating-a-team-working-agreement/">working agreement</a> that the whole team is willing to adhere to, not just what the coach or a few think is the &#8220;right&#8221; agreements to have.</li>
</ul>
<p>Try these out on your own or with your team and see how they work for you. Modify as necessary and always look for improvements. There are many thought leaders in the Agile community that have written down important principles that may work for you and your team.</p>
<p>And finally, now that I have filled an entire blog post with &#8220;Executable Design&#8221; what do people think about the name? It has worked for me in the past to explain the basic nature of TDD so I will use it either way unless others have better names that I can steal?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingagile.com/2008/12/13/executable-design-a-new-name-for-tdd/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Managing Software Debt presentation @ Agile Vancouver</title>
		<link>http://www.gettingagile.com/2008/11/10/managing-software-debt-presentation-agile-vancouver/</link>
		<comments>http://www.gettingagile.com/2008/11/10/managing-software-debt-presentation-agile-vancouver/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 04:15:46 +0000</pubDate>
		<dc:creator>Chris Sterling</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Leadership]]></category>
		<category><![CDATA[Product Owner]]></category>
		<category><![CDATA[Scrum]]></category>
		<category><![CDATA[Software Architecture]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://chrissterling.gettingagile.com/?p=174</guid>
		<description><![CDATA[On November 6th I presented an updated version of the Managing Software Debt talk at Agile Vancouver &#8220;Much Ado About Agile&#8221; conference. This is a link to the presentation deck:
Managing Software Debt &#8211; Agile Vancouver (PDF)
I was honored to present at this local conference and had a great time meeting up with old friends and [...]]]></description>
			<content:encoded><![CDATA[<p>On November 6th I presented an updated version of the Managing Software Debt talk at Agile Vancouver &#8220;Much Ado About Agile&#8221; conference. This is a link to the presentation deck:</p>
<p><a title="Managing Software Debt - Agile Vancouver Nov 2008" href="http://gettingagile.com/csterwa/Managing%20Software%20Debt%20-%20Agile%20Vancouver%20Nov%202008.pdf" target="_blank">Managing Software Debt &#8211; Agile Vancouver (PDF)</a></p>
<p>I was honored to present at this local conference and had a great time meeting up with old friends and getting to know some new ones. I hope that I can do this again soon. If you are interested in more information and other presentations at Agile Vancouver you can go to their <a title="Agile Vancouver 2008 conference home page" href="http://www.agilevancouver.ca/?p2=/modules/agilevancouver/conferences.jsp" target="_blank">home page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingagile.com/2008/11/10/managing-software-debt-presentation-agile-vancouver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Defining the &quot;Unit&quot; in Unit Testing</title>
		<link>http://www.gettingagile.com/2008/09/27/defining-the-unit-in-unit-testing/</link>
		<comments>http://www.gettingagile.com/2008/09/27/defining-the-unit-in-unit-testing/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 07:09:19 +0000</pubDate>
		<dc:creator>Chris Sterling</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[XP]]></category>

		<guid isPermaLink="false">http://chrissterling.gettingagile.com/2008/09/27/defining-the-unit-in-unit-testing/</guid>
		<description><![CDATA[&#8220;Hey, Ben. We just figured out a great way to manage test-driven development and good database design.&#8221;, said an enthusiastic developer using Extreme Programming (XP) practices on their project. &#8220;Our application is highly data-centric. Therefore, in the first iteration we design the database schema modifications and create tests to validate all of it&#8217;s implementation characteristics. [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;Hey, Ben. We just figured out a great way to manage test-driven development and good database design.&#8221;, said an enthusiastic developer using <a target="_blank" href="http://www.extremeprogramming.org/">Extreme Programming (XP)</a> practices on their project. &#8220;Our application is highly data-centric. Therefore, in the first iteration we design the database schema modifications and create tests to validate all of it&#8217;s implementation characteristics. The next iteration we build the data access layer and business services on top of the database modifications. This has allowed us to design the database correctly before developing code around the wrong data model. What do you think about this approach?&#8221;
<p>Ben is an agile coach who checks in with this team from time to time. He likes the fact that this team has continually looked for improvements in the way they develop software. In this case Ben sees a potential issue and so he asks a question, &#8220;What do you deliver to the customer at the end of your first iteration?&#8221;. </p>
<p>&#8220;We show the customer our database design and tests executing.&#8221; </p>
<p>&#8220;What does the customer think about this?&#8221; Ben probes further.</p>
<p>&#8220;He doesn&#8217;t seem to care about this part of our product review. He told us that we should just show him the finished feature after the next iteration.&#8221;</p>
<p>&#8220;Didn&#8217;t we setup a Definition of Done for the team to assess quality of our delivery each iteration? If we don&#8217;t have customer accepted functionality at the end of the iteration didn&#8217;t we decide that the work is not done?&#8221;</p>
<p>&#8220;Yeah, but we found out that the data design and automated test case development for it takes too long to fit into an iteration along with feature development on top of it.&#8221;</p>
<p>&#8220;Hmmm, that sounds like we may be working around our definition of done which seems like a &#8217;smell&#8217; in our process. Lets sit down and see what the root cause of this new process that extends development of functionality over two iterations rather than within one iteration.&#8221;</p>
<p>Relational databases have proven themselves to be great persistence platforms. As their usage increased in software development they have gone beyond their intended usage into the application server realm with stored procedures, functions, and triggers not to mention parsing and other functionality added recently in the marketplace. Applications become highly dependent on a relational database and become more difficult to change over time. The more difficult the relational database becomes to change the more we baby it and look for ways to not have to modify it for long periods of time. This leads to designing up front and the &#8220;getting it right the first time&#8221; mentality with our data models.</p>
<p>When we start in the bowels of our system with design, tests, and implementation we tend to <a target="_blank" href="http://www.codinghorror.com/blog/archives/000150.html">&#8220;gold plate&#8221;</a> our implementation. Thus developing more code and tests than is actually needed for the implementation. Many times this approach violates the <a target="_blank" href="http://en.wikipedia.org/wiki/YAGNI">YAGNI (&#8220;you ain&#8217;t gonna need it&#8221;)</a> guideline for agile software development.</p>
<p>During coaching engagements I speak with team members about starting from the user&#8217;s point of view even in development of your unit tests. What is the next piece of functionality that will support their feature request? Many developers immediately comment that these are no longer &#8220;unit tests&#8221; as they have previously defined them. I ask what they characterize as a unit test and it usually is not easy for them to verbalize. If we think of a unit as part of an existing design we will tend to write tests for all potential ways the design could be used. If we always drive our next test based on what the next unit of functionality should do for the user then we will implement only what is necessary.</p>
<p><a target="_blank" href="http://en.wikipedia.org/wiki/Behavior_Driven_Development">Behavior-Driven Development (BDD) </a>describes a process for developing from the outside in. The first piece of code the developer implements in this approach is the interface. From the interface a developer drives out the rest of the functionality. This ensures that all code is directly related to functionality valuable to the customer or other code already written. Although there are great frameworks out there to support BDD in your development environment you can begin by starting to think about your xUnit tests in this manner. Start from the interface and make sure each additional capability implemented to satisfy a test is adding or supporting value from the user&#8217;s point of view. Please read <a target="_blank" href="http://en.wikipedia.org/wiki/Behavior_Driven_Development">this wikipedia entry on BDD</a> for actual test case and code examples.</p>
<p>In addition, I will make a suggestion that whenever a technology element within your architecture is difficult to change you should definitely minimize interactions with it and abstract all access. Proper unit testing that focuses on a unit of code will force the use of proper interface abstractions in order to not make the test dependent on components external to the unit such as a database. Minimizing interactions will reduce your application&#8217;s dependence and also increase changeability of it for future business functionality to be implemented. Business changes so software should be able to change with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingagile.com/2008/09/27/defining-the-unit-in-unit-testing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Beat Cross-site Scripting Issue with StoryTestIQ</title>
		<link>http://www.gettingagile.com/2008/08/25/beat-cross-site-scripting-issue-with-storytestiq/</link>
		<comments>http://www.gettingagile.com/2008/08/25/beat-cross-site-scripting-issue-with-storytestiq/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 06:20:32 +0000</pubDate>
		<dc:creator>Chris Sterling</dc:creator>
				<category><![CDATA[Acceptance Testing]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[Architecture]]></category>
		<category><![CDATA[DotNet]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://chrissterling.gettingagile.com/?p=105</guid>
		<description><![CDATA[A few years ago I was privileged to be on a team with some excellent developers where I currently work, SolutionsIQ. One of whom saw the need to stabilize development on an incredibly unstable codebase with no tests. He came to the team with a proposed tool that he slapped together in his free time. [...]]]></description>
			<content:encoded><![CDATA[<p>A few years ago I was privileged to be on a team with some excellent developers where I currently work, <a href="http://www.solutionsiq.com/" target="_blank">SolutionsIQ</a>. One of whom saw the need to stabilize development on an incredibly unstable codebase with no tests. He came to the team with a proposed tool that he slapped together in his free time. It was a mashup of Selenium and FitNesse along with some modifications to support some special needs we had on the project. His name was Paul Dupuy and the entire team, including Mickey Phoenix, Rand Huso, Jonathon Golden, and Charles Liu, spent some time working on enhancing the tool, now called <a href="http://storytestiq.sf.net/" target="_blank">StoryTestIQ (aka &#8216;STIQ&#8217;)</a>, to make it what it is today. Other teams at SolutionsIQ have been using StoryTestIQ, as well, and helping to enhance its capabilities from time to time.</p>
<p>One issue that we have had is that the visual testing portion of StoryTestIQ runs inside a web browser. The security models for each browser is a little bit different but for the most part they <a href="http://www.mozilla.org/projects/security/components/same-origin.html" target="_blank">restrict cross-site scripting</a>. For most of the projects we have used StoryTestIQ on the customer&#8217;s browser was always Microsoft Internet Explorer (IE). Given this constraint we were able to run in a special non-secured mode of IE called <a href="http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx" target="_blank">HTML Applications (HTA)</a>. This mode of IE also has a problem. The browser history is not retained while in HTA mode therefore some JavaScript functions will not work if used in your application.</p>
<p>Recently I have been working on a project that must work in multiple browsers. Also, I have a Mac so the constraint of using IE is not necessarily reasonable without some coaxing. Instead I decided to take on a quick Apache2 with mod_proxy experiment to see if I could serve both StoryTestIQ, which serves its pages from the FitNesse server inside, and the project&#8217;s web application server. It worked and so now I will share it with you.</p>
<p>I will assume that you are already <a href="http://storytestiq.solutionsiq.com/wiki/Getting_Started" target="_blank">using StoryTestIQ</a> and have <a href="http://httpd.apache.org/" target="_blank">Apache2</a> installed already. If not, please make sure each of these run within your environment before moving on. In my first configuration the project I was developing is running on the <a href="http://www.mortbay.org/jetty-6/" target="_blank">Jetty web application server</a> on port 8080. I started up StoryTestIQ on port 9999 and left my project&#8217;s web application up and running while I configured Apache2. I used MacPorts to install apache2 in the /opt/local/apache2 directory. In my environment the httpd.conf, Apache2 main configuration file, was located at /opt/local/apache2/conf/httpd.conf. In your own Apache2 installation find the default httpd.conf file for configuring the server. Inside the httpd.conf configuration file make sure that mod_proxy is installed and loaded by searching for a line similar to this:</p>
<p><em>LoadModule proxy_module modules/mod_proxy.so</em></p>
<p>If you are not currently using mod_proxy then please review their web site to install and configure mod_proxy for your environment. If mod_proxy is successfully installed then you can add the following lines to the httpd.conf file below all of the LoadModule entries:</p>
<p><em>#<br />
# Proxy configuration for STIQ and local Jetty application<br />
#<br />
ProxyPass         /stiq  http://localhost:9999/stiq<br />
ProxyPassReverse  /stiq  http://localhost:9999/stiq<br />
ProxyPass         /files  http://localhost:9999/files<br />
ProxyPassReverse  /files  http://localhost:9999/files<br />
ProxyPass         /STIQResults  http://localhost:9999/STIQResults<br />
ProxyPassReverse  /STIQResults  http://localhost:9999/STIQResults<br />
ProxyPass         /myapp  http://localhost:8080/myapp<br />
ProxyPassReverse  /myapp  http://localhost:8080/myapp<br />
</em></p>
<p><em>#<br />
# Rewrite ProjectRoot, STIQ repository main content page, to STIQ server<br />
#<br />
</em><em>RewriteEngine On<br />
RewriteLog &#8220;/opt/local/apache2/logs/rewrite.log&#8221;<br />
RewriteRule ^/ProjectRoot(.*) http://localhost:9999/ProjectRoot$1 [P]</em></p>
<p>There are multiple directories which can be easily proxied using basic ProxyPass and ProxyPassReverse directives. These are /stiq, /files, and /STIQResults. Due to the wiki page URL construction the main content page within the STIQ repository cannot use these basic directives. Instead you must use the RewriteEngine with a rule to map any URL starting with /ProjectRoot* to the STIQ Server. The problem was that the wiki page would ask for a URL such as http://localhost:9999/ProjectRoot.StoryTests and the basic proxy directives would see this as a new URL compared to basic /ProjectRoot. The use of the RewriteRule allows anything that starts with /ProjectRoot to get proxied across.</p>
<p>Once you have these configurations added to the httpd.conf you can restart the Apache2 server. In my environment the command was:</p>
<p><em>/opt/local/apache2/bin/httpd -k restart</em></p>
<p>After the web server is restarted you can launch StoryTestIQ inside your browser using a URL similar to this one:</p>
<p><em>http://localhost/stiq/runner.html?startPage=/ProjectRoot&amp;suite=StoryTests</em></p>
<p>You&#8217;ll notice that this is going through the default HTTP port 80 instead of STIQ&#8217;s port 9999. We are now proxied on port 80 to port 9999 for STIQ related URL. You can write automated acceptance tests opening  a URL starting with <em>http://localhost/myapp </em>and it will proxy to port 8080 where your web application is running. Make sure to have all of the port numbers correct in your configurations if your environment differs from mine.</p>
<p>I have also configured a <a href="http://www.rubyonrails.org/" target="_blank">Ruby on Rails</a> application for automated acceptance tests against with STIQ. In that case I had to configure mod_proxy with the following directive adding an application name to the Apache2 URL to proxy:</p>
<p><em>ProxyPass         /myapp  http://localhost:3000<br />
ProxyPassReverse  /myapp  http://localhost:3000</em></p>
<p>You can see the welcome page for your application using this basic configuration but once you have any URL locations identified in your web pages that start with &#8216;/&#8217; they will not be found. In order to support URL which start with &#8216;/&#8217; you must modify the appropriate environment configuration inside your Ruby on Rails application. The environment configuration are found in the <em>${project_root}/config/environments </em>directory by default. I added the following to my development.rb environment configuration file which is what I use with STIQ:</p>
<p><em># This allows me to run using mod_proxy on Apache2<br />
# Using StoryTestIQ for automated acceptance testing<br />
# It runs in a browser and therefore cross-site scripting is not allowed<br />
# which the mod_proxy allows me to get around by passing both the StoryTestIQ<br />
# server and the application under test through the same root URL<br />
ActionController::AbstractRequest.relative_url_root = &#8220;/myapp&#8221; </em></p>
<p>This will cause all requests for URL starting with a &#8216;/&#8217; to become &#8216;/myapp/&#8217;. This allows them to be found through the Apache2 proxy.</p>
<p>If you are interested in beating the cross-site scripting restrictions of most major browsers for use with <a href="http://storytestiq.sf.net/" target="_blank">StoryTestIQ</a> I hope this blog entry will help you out. This same mechanism could help with other tools out there who have browser restriction issues. Let me know through your comments if this worked for you or if you have any suggestions on modifications that could make this easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingagile.com/2008/08/25/beat-cross-site-scripting-issue-with-storytestiq/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
