<?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>Shaaf's Blog</title>
	<atom:link href="http://www.shaafshah.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shaafshah.com</link>
	<description>Another bit in the wall</description>
	<lastBuildDate>Wed, 12 Aug 2009 14:28:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Getting started with JBehave in 8 steps.</title>
		<link>http://www.shaafshah.com/2009/08/12/getting-started-with-jbehave-in-8-steps/</link>
		<comments>http://www.shaafshah.com/2009/08/12/getting-started-with-jbehave-in-8-steps/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 14:13:30 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jbehave]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=256</guid>
		<description><![CDATA[This post is about JBehave and how to quickly get started with it. If you would like to know about BDD please use the following link.
What is Behavioral Driven Development?
Today I have used JBehave for the first time. It does have some convincing factors for instance diving requirements into scenarios which map pretty nicely to [...]]]></description>
			<content:encoded><![CDATA[<p>This post is about JBehave and how to quickly get started with it. If you would like to know about BDD please use the following link.<br />
<a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development">What is Behavioral Driven Development?</a></p>
<p>Today I have used JBehave for the first time. It does have some convincing factors for instance diving requirements into scenarios which map pretty nicely to the tests that are written with in the Steps. Thus it seems like it would be easier for Stakeholder/s to use it as a good guideline for the initial requirements. Its always quite usual to come up to some disagreements about the development however the tool does help to bring forth the ease for stake holders who really dont have to get into writing code but will have a technical jargon to communicate through to the developers in shape of scenarios.</p>
<p>So the first things come up.<br />
1. Create a Java project in Eclipse.<br />
2. Download the JBehave latest version from the <a href="http://jbehave.org/software/download/">website</a> and add the jar files to your project build classpath<br />
3. Create a scenario file and name it as user_wants_to_shop.scenario</p>
<p>Add the following text to the file</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="java">Given user Shaaf is logged in
Check <span style="color: #000000; font-weight: bold;">if</span> user shaaf is Allowed to shop
Then show shaaf his shopping cart</pre></td></tr></table></div>

<p>The lines above simply state the rules for the scenario we are about to create.</p>
<p>4. Now we will create a java file mapping to it.</p>
<p>Create a new class with the name corresponding to the same as the .scenario file<br />
UserWantsToShop.java</p>
<p>Add the following code to it</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="java"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jbehave.scenario.PropertyBasedConfiguration</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jbehave.scenario.Scenario</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jbehave.scenario.parser.ClasspathScenarioDefiner</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jbehave.scenario.parser.PatternScenarioParser</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jbehave.scenario.parser.ScenarioDefiner</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jbehave.scenario.parser.UnderscoredCamelCaseResolver</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> UserWantsToShop <span style="color: #000000; font-weight: bold;">extends</span> Scenario <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// The usual constructor with default Configurations.</span>
	<span style="color: #000000; font-weight: bold;">public</span> UserWantsToShop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> ShoppingSteps<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Mapping .scenario files to the scenario. This is not by default.</span>
    <span style="color: #000000; font-weight: bold;">public</span> UserWantsToShop<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">ClassLoader</span> classLoader<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> PropertyBasedConfiguration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">public</span> ScenarioDefiner forDefiningScenarios<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> ClasspathScenarioDefiner<span style="color: #009900;">&#40;</span>
                    <span style="color: #000000; font-weight: bold;">new</span> UnderscoredCamelCaseResolver<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;.scenario&quot;</span><span style="color: #009900;">&#41;</span>, 
                    <span style="color: #000000; font-weight: bold;">new</span> PatternScenarioParser<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>, classLoader<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>, <span style="color: #000000; font-weight: bold;">new</span> ShoppingSteps<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>5. Just that we now have steps we need some place to put the logic for the Steps in the Scenarios. So we create a new Steps class ShoppingSteps.java</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="java"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jbehave.scenario.annotations.Given</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jbehave.scenario.annotations.Then</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jbehave.scenario.annotations.When</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.jbehave.scenario.steps.Steps</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ShoppingSteps <span style="color: #000000; font-weight: bold;">extends</span> Steps <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>6. Now you can run the Scenario by running it as a Junit Test.</p>
<p>Following should be the output</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="java">Scenario<span style="color: #339933;">:</span> 
&nbsp;
Given I am not logged in <span style="color: #009900;">&#40;</span>PENDING<span style="color: #009900;">&#41;</span>
When I log in as Shaaf with a password JBehaver <span style="color: #009900;">&#40;</span>PENDING<span style="color: #009900;">&#41;</span>
Then I should see my <span style="color: #0000ff;">&quot;Shopping Cart&quot;</span> <span style="color: #009900;">&#40;</span>PENDING<span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>This means that none of the scenario requirements have been implemented as yet. But the test result should be green to show there are no problems with our setup.</p>
<p>Now lets add the implementation to the tests.</p>
<p>7. Add the body to the ShoppingSteps. I have added the comments with the methods.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="java">        <span style="color: #666666; font-style: italic;">// Given that a user(param) is loggen in</span>
	@Given<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;user $username is logged in&quot;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> logIn<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> userName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		checkInSession<span style="color: #009900;">&#40;</span>userName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// Check if the user is allowed on the server</span>
	@When<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;if user $username is $permission to shop&quot;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> isUserAllowed<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> userName, <span style="color: #003399;">String</span> permission<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		getUser<span style="color: #009900;">&#40;</span>userName<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">isUserAllowed</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>permission<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
       <span style="color: #666666; font-style: italic;">// finally then let him use the shopping cart.</span>
	@Then<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;show $username his Shopping cart&quot;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> getMyCart<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> userName, <span style="color: #003399;">String</span> cart<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		getUserCart<span style="color: #009900;">&#40;</span>userName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>8. Now you should try to run the scenario again. And all of the test should be green. I have not implemented the actual methods so they will be red. <img src='http://www.shaafshah.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.shaafshah.com/2009/08/12/getting-started-with-jbehave-in-8-steps/&amp;t=Getting+started+with+JBehave+in+8+steps.&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.shaafshah.com/2009/08/12/getting-started-with-jbehave-in-8-steps/&amp;title=Getting+started+with+JBehave+in+8+steps.&amp;t=1 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.shaafshah.com/2009/08/12/getting-started-with-jbehave-in-8-steps/&amp;title=Getting+started+with+JBehave+in+8+steps.&amp;t=2 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Getting+started+with+JBehave+in+8+steps.;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=small-votes></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.shaafshah.com/2009/08/12/getting-started-with-jbehave-in-8-steps/'; tweetmeme_style = 'compact';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2009/08/12/getting-started-with-jbehave-in-8-steps/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Logging with log4J isDebugEnabled</title>
		<link>http://www.shaafshah.com/2009/08/12/logging-with-log4j-isdebugenabled/</link>
		<comments>http://www.shaafshah.com/2009/08/12/logging-with-log4j-isdebugenabled/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 12:39:52 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[best practise]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[log4j]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=248</guid>
		<description><![CDATA[Alot of times I have seen the questions popping up whether to use isDebugEnabled property or not. Arguably most of the times or rather always about performance. Some of the stuff that I feel important about using it follows.]]></description>
			<content:encoded><![CDATA[<p>Alot of times I have seen the questions popping up whether to use isDebugEnabled property or not. Arguably most of the times or rather always about performance. Some of the stuff that I feel important about using it follows.</p>
<p>The answer is simple. It is made to be used. However using it has to be with caution.</p>
<p>For instance<br />
If I am using the following line in my code.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="java">log.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;I am there&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Thats an example of a good practise</p>
<p>However I can really blow it out of proportions if I do the following.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="java"><span style="color: #666666; font-style: italic;">// Not good practise</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>log.<span style="color: #006633;">isDebugEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    log.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;I am there&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And why exactly is that so. This is because the method debug in the class Category i.e. extended by Logger in the log4j libraries explicitly checks the mode for the logging itself.</p>
<p>Extract from the class org.apache.log4j.Category is below</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="java"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> debug<span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> message<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>repository.<span style="color: #006633;">isDisabled</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">DEBUG_INT</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>Level.<span style="color: #006633;">DEBUG</span>.<span style="color: #006633;">isGreaterOrEqual</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getEffectiveLevel</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
forcedLog<span style="color: #009900;">&#40;</span>FQCN, Level.<span style="color: #006633;">DEBUG</span>, message, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Okay so thats the case where we say dont use it. What about the one where we actually do use the isDebugEnabled property.</p>
<p>For instance you have a large parameter going in the debug.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="java"><span style="color: #666666; font-style: italic;">// Bad Practise</span>
 log.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;XML &quot;</span><span style="color: #339933;">+</span>Tree.<span style="color: #006633;">getXMLText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>In such a case it can clearly be said &#8220;No dont do it!&#8221; If Tree.getXMLText is going to pull out all the hair out of the app then there is no use. As it will be constructed first and if the debug level is not enabled that would be a performance cost.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="java"><span style="color: #666666; font-style: italic;">// Good Practise</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>log.<span style="color: #006633;">isDebugEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    log.<span style="color: #006633;">debug</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;XML &quot;</span><span style="color: #339933;">+</span>Tree.<span style="color: #006633;">getXMLText</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Thus in the example above it would be wiser to use log.isDebugEnabled() just to make sure the mileage or cost stays lesser. </p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.shaafshah.com/2009/08/12/logging-with-log4j-isdebugenabled/&amp;t=Logging+with+log4J+isDebugEnabled&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.shaafshah.com/2009/08/12/logging-with-log4j-isdebugenabled/&amp;title=Logging+with+log4J+isDebugEnabled&amp;t=1 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.shaafshah.com/2009/08/12/logging-with-log4j-isdebugenabled/&amp;title=Logging+with+log4J+isDebugEnabled&amp;t=2 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Logging+with+log4J+isDebugEnabled;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=small-votes></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.shaafshah.com/2009/08/12/logging-with-log4j-isdebugenabled/'; tweetmeme_style = 'compact';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2009/08/12/logging-with-log4j-isdebugenabled/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Keep it simple, short and stupid (KISS)</title>
		<link>http://www.shaafshah.com/2009/06/22/keep-it-simple-short-and-stupid/</link>
		<comments>http://www.shaafshah.com/2009/06/22/keep-it-simple-short-and-stupid/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 13:59:07 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=228</guid>
		<description><![CDATA[&#8220;everything should be made as simple as possible, but no simpler&#8221; &#8211; Albert Einstein
-
I am sitting in a design room today designing a simple requirement for a client. He wants me to enhance the transfer money from one account to another. Just that it happens that I have my best friend Yuky sitting right next [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;everything should be made as simple as possible, but no simpler&#8221; &#8211; <a title="Albert Einstein" href="http://en.wikipedia.org/wiki/Albert_Einstein">Albert Einstein</a></p>
<p>-</p>
<p>I am sitting in a design room today designing a simple requirement for a client. He wants me to enhance the transfer money from one account to another. Just that it happens that I have my best friend Yuky sitting right next to me. He is damn good in Maths and extra ordinarily knows all the calculations on his tips. I am sure if I had asked him what was the angle of sight to the light on the wall he could just tell me in a few seconds looking with 10 eyes at his 12 fingers, trust me it will be correct.</p>
<p>Just that I cannot ignore his brilliance and just that I admire it sometimes and posed to be inspired by it all the time, I don&#8217;t agree with it all the time!</p>
<p>And this is what I mention here today.KISS (Keep it simple, short and stupid)</p>
<p>Rule# 1.  Don&#8217;t try to be a super genius.</p>
<p>Rule# 2. Don&#8217;t over do it!</p>
<p>Rule# 3. Break down your problems</p>
<p>Rule# 4. Common Sense has to prevail</p>
<p>Rule# 5. Keep your mess small, don&#8217;t litter around the park.</p>
<p>Most importantly keep everything short, simple and stupid. </p>
<p>I recently had to deliver a few minutes inspirational presentation on Test Driven Development and especially about KISS. Attached is some of the material. Feel free to explore.</p>
<p><a href="http://www.shaafshah.com/wp-content/uploads/2009/06/what-is-kiss.pdf">What is the KISS principle?</a></p>
<p>Could be more simpler <img src='http://www.shaafshah.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.shaafshah.com/2009/06/22/keep-it-simple-short-and-stupid/&amp;t=Keep+it+simple%2C+short+and+stupid+%28KISS%29&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.shaafshah.com/2009/06/22/keep-it-simple-short-and-stupid/&amp;title=Keep+it+simple%2C+short+and+stupid+%28KISS%29&amp;t=1 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.shaafshah.com/2009/06/22/keep-it-simple-short-and-stupid/&amp;title=Keep+it+simple%2C+short+and+stupid+%28KISS%29&amp;t=2 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Keep+it+simple%2C+short+and+stupid+%28KISS%29;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=small-votes></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.shaafshah.com/2009/06/22/keep-it-simple-short-and-stupid/'; tweetmeme_style = 'compact';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2009/06/22/keep-it-simple-short-and-stupid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automation with Selenium,Junit, Ant</title>
		<link>http://www.shaafshah.com/2009/01/19/automation-with-seleniumjunit-ant/</link>
		<comments>http://www.shaafshah.com/2009/01/19/automation-with-seleniumjunit-ant/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 14:31:52 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[automated-testing]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[CI]]></category>
		<category><![CDATA[continous]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[Junit]]></category>
		<category><![CDATA[scm]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=159</guid>
		<description><![CDATA[What is Selenium
How does Selenium work
History and how it started
About Ant
And Junit
Much of the technologies above do not or will not need an introduction if you already know them or can read them from the links above.
More over today&#8217;s article is more about how we can use all the three selenium, ant and junit to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://seleniumhq.org/">What is Selenium</a><br />
<a href="http://seleniumhq.org/about/how.html">How does Selenium work</a><br />
<a href="http://seleniumhq.org/about/history.html">History and how it started</a><br />
<a href="http://ant.apache.org/">About Ant</a><br />
<a href="http://www.junit.org/">And Junit</a></p>
<p>Much of the technologies above do not or will not need an introduction if you already know them or can read them from the links above.</p>
<p>More over today&#8217;s article is more about how we can use all the three selenium, ant and junit to come up with an automated solution for regressive testing.</p>
<p>Please refer to the documentation links above for the basic knowledge on any of the used tools.</p>
<p>I am assuming that you know how to record a test in selenium if you dont then go <a href="http://selenium-ide.seleniumhq.org/">here</a></p>
<p>Now that you do know how to record and save the tests simply save them in any directory structure you like as long as they follow the right package convention. like com.foo.bar<br />
this would mean the file should be in directory like com/foo/bar. Conventionally and logically today that is how the TestCase is compiled through the ant script. If the package is not the right path then compile time errors will occur.</p>
<p>My calling target for running the whole procedure should look like this</p>
<pre>
< target name="build_tests" depends="clean, compile, start-server,  tests, stop-server" / >
</pre>
<p>Details of the depending targets are as follows.<br />
<strong>clean:</strong> would clean the entire build directories etc to make sure nothing from our past is carried forward into the future.</p>
<p><strong>compile:</strong> should compile</p>
<p><strong>start-server:</strong> should start the selenium server.</p>
<p><strong>tests:</strong> should run the selenium tests.</p>
<p><strong>stop-server:</strong> should stop the selenium server once all tests have been executed.</p>
<p><strong>How to start a selenium server from Ant?</strong></p>
<pre>
    < target name="start-server" >
        < java jar="lib/selenium-server.jar" fork="true" spawn="true" >
            < arg line="-timeout 30" / >
            < jvmarg value="-Dhttp.proxyHost=proxy.proxyhost.com" / >
            < jvmarg value="-Dhttp.proxyPort=44444" / >
        < / java >
    < / target >
</pre>
<p> </p>
<p>The target above is simply taking the selenium-server.jar which is in the classpath and running the main-class from it. the proxy parameters are optional.</p>
<p><strong>How to stop the server from Ant?</strong></p>
<pre>
 < target name="stop-server" >
        < get taskname="selenium-shutdown"
            src="http://localhost:4444/selenium-server/driver/?cmd=shutDown"
            dest="result.txt" ignoreerrors="true" / >
        < echo taskname="selenium-shutdown" message="DGF Errors during shutdown are expected" / >
    < / target >
 </pre>
<p>The selenium server starts on port 4444 by default and to tell it to shutdown is simple, the command in the src is passed to it. cmd=shutDown<br />
That should just shutdown the server.</p>
<p><strong>Executing the test cases?</strong><br />
Selenium Test cases are Junit tests cases and that&#8217;s how they are treated in this tutorial.<br />
Thus some of you will be very much familiar with the ant targets <a href="http://ant.apache.org/manual/OptionalTasks/junit.html">junit</a> and <a href="http://ant.apache.org/manual/OptionalTasks/junitreport.html">junitreport</a>. However I will describe how the following is working.<br />
the following target will run the selenium tests and print a summary report to the ${dir}<br />
The includes and excludes, simply tell the target which files to include or exclude while running the test cases. This is typically done when you don&#8217;t want some tests cases to be included or your source for tests and the application are in the same directory and you only want to include something like Test*.class. </p>
<pre>
  < target name="tests" depends="compileonly" description="runs JUnit tests" >
    < echo message="running JUnit tests" / >
    < junit printsummary="on" dir=".." haltonfailure="off" haltonerror="off" timeout="${junit.timeout}" fork="on" maxmemory="512m" showoutput="true" >
      < formatter type="plain" usefile="false" / >
      < formatter type="xml" usefile="true" / >
      < batchtest todir="${testoutput}" filtertrace="on" >
        < fileset dir="${src}" >
          < includesfile name="${tests.include}" / >
          < excludesfile name="${tests.exclude}" / >
        < / fileset >
      < / batchtest >
      < classpath >
        < pathelement path="${classes}" / >
        < pathelement path="${build.classpath}" / >
      < / classpath >
    < / junit >
</pre>
<p>The following will take the formatted output from the lines above and generate a report out of it in xml and html and place the results in the ${reports}/index.html<br />
A sample Junit test report might look like <a href="http://studios.thoughtworks.com/cruise-continuous-integration/1.0/help/resources/images/cruise/tab-with-junit.png">this</a>.</p>
<pre>
   < echo message="running JUnit Reports" / >
   < junitreport todir="${reports}" >
      < fileset dir="${reportdir}" >
        < include name="Test*.xml" / >
      < / fileset >
      < report format="frames" todir="${reports}" / >
    < / junitreport >
    < echo message="To see your Junit results, please open ${reports}/index.html}" / >
  < / target >
</pre>
<p>In general you can add all of this to your nightly build through any of the CI servers like Cruise Control. Also as a general practice you will need to do a  little more then just executing this target every night depending on your application. For instance cleaning up of resource centers like Databases etc.</p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.shaafshah.com/2009/01/19/automation-with-seleniumjunit-ant/&amp;t=Automation+with+Selenium%2CJunit%2C+Ant&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.shaafshah.com/2009/01/19/automation-with-seleniumjunit-ant/&amp;title=Automation+with+Selenium%2CJunit%2C+Ant&amp;t=1 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.shaafshah.com/2009/01/19/automation-with-seleniumjunit-ant/&amp;title=Automation+with+Selenium%2CJunit%2C+Ant&amp;t=2 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Automation+with+Selenium%2CJunit%2C+Ant;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=small-votes></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.shaafshah.com/2009/01/19/automation-with-seleniumjunit-ant/'; tweetmeme_style = 'compact';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2009/01/19/automation-with-seleniumjunit-ant/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Calling wsadmin scripts from ant</title>
		<link>http://www.shaafshah.com/2008/12/11/calling-wsadmin-scripts-from-ant/</link>
		<comments>http://www.shaafshah.com/2008/12/11/calling-wsadmin-scripts-from-ant/#comments</comments>
		<pubDate>Thu, 11 Dec 2008 08:17:46 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Administrator]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jdbc]]></category>
		<category><![CDATA[jython]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[websphere]]></category>
		<category><![CDATA[wsadmin]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=148</guid>
		<description><![CDATA[You can simply add the following to a target.
For the following wsadmin should be in your PATH env.
< exec dir="." executable="wsadmin.bat" logError="true" failonerror="true" output="wsconfig.out" >
   < arg line="-lang jython -f ../../createQFactory.py"/ >
< /exec >
All output will be logged to wsconfig.out
     tweetmeme_url='http://www.shaafshah.com/2008/12/11/calling-wsadmin-scripts-from-ant/'; tweetmeme_style = 'compact';; ]]></description>
			<content:encoded><![CDATA[<p>You can simply add the following to a target.<br />
For the following wsadmin should be in your PATH env.</p>
<p>< exec dir="." executable="wsadmin.bat" logError="true" failonerror="true" output="wsconfig.out" ><br />
   < arg line="-lang jython -f ../../createQFactory.py"/ ><br />
< /exec ></p>
<p>All output will be logged to wsconfig.out</p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.shaafshah.com/2008/12/11/calling-wsadmin-scripts-from-ant/&amp;t=Calling+wsadmin+scripts+from+ant&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.shaafshah.com/2008/12/11/calling-wsadmin-scripts-from-ant/&amp;title=Calling+wsadmin+scripts+from+ant&amp;t=1 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.shaafshah.com/2008/12/11/calling-wsadmin-scripts-from-ant/&amp;title=Calling+wsadmin+scripts+from+ant&amp;t=2 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Calling+wsadmin+scripts+from+ant;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=small-votes></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.shaafshah.com/2008/12/11/calling-wsadmin-scripts-from-ant/'; tweetmeme_style = 'compact';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/12/11/calling-wsadmin-scripts-from-ant/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Generate XML &#8211; DBMS_XMLGEN</title>
		<link>http://www.shaafshah.com/2008/12/10/generate-xml-dbms_xmlgen/</link>
		<comments>http://www.shaafshah.com/2008/12/10/generate-xml-dbms_xmlgen/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 14:58:04 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[DBMS_XMLGEN]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[utils]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=137</guid>
		<description><![CDATA[On my way to my solution store just found this nice to use, old and easy feature.
Possibilities endless, usage typically very easy.
I used the following to generate XML from sqlplus:
 select dbms_xmlgen.getxml('select * from user') from dual; 
Output:

< ROWSET >
 < ROW >
  < TNAME >Employee< / TNAME >
  < TABTYPE > TABLE [...]]]></description>
			<content:encoded><![CDATA[<p>On my way to my solution store just found this nice to use, old and easy feature.<br />
Possibilities endless, usage typically very easy.</p>
<p>I used the following to generate XML from sqlplus:</p>
<pre lang="SQL" line=1> select dbms_xmlgen.getxml('select * from user') from dual; </pre>
<p><strong>Output:</strong></p>
<pre lang="XML" line=1>
< ROWSET >
 < ROW >
  < TNAME >Employee< / TNAME >
  < TABTYPE > TABLE < / TABTYPE >
 < / ROW >
< / ROWSET >
</pre>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.shaafshah.com/2008/12/10/generate-xml-dbms_xmlgen/&amp;t=Generate+XML+-+DBMS_XMLGEN&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.shaafshah.com/2008/12/10/generate-xml-dbms_xmlgen/&amp;title=Generate+XML+-+DBMS_XMLGEN&amp;t=1 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.shaafshah.com/2008/12/10/generate-xml-dbms_xmlgen/&amp;title=Generate+XML+-+DBMS_XMLGEN&amp;t=2 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Generate+XML+-+DBMS_XMLGEN;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=small-votes></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.shaafshah.com/2008/12/10/generate-xml-dbms_xmlgen/'; tweetmeme_style = 'compact';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/12/10/generate-xml-dbms_xmlgen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Command, Singleton, JMenuItem, JButton, AbstractButton &#8211; One Listener for the app</title>
		<link>http://www.shaafshah.com/2008/11/17/command-singleton-jmenuitem-jbutton-abstractbutton-one-listener-for-the-app/</link>
		<comments>http://www.shaafshah.com/2008/11/17/command-singleton-jmenuitem-jbutton-abstractbutton-one-listener-for-the-app/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 19:17:24 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[AbstractButton]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[Computers]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[GOF]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JButton]]></category>
		<category><![CDATA[JMenuItem]]></category>
		<category><![CDATA[Patterns]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Singleton]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Swing]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=124</guid>
		<description><![CDATA[Here I would like to demonstrate a simple use of JMenuItems being used with Single Listener for the entire system.
A simple sample of use would probably be SingleInstance Desktop Application.
Lets see how that is done here.
1. First lets create a OneListener class that should be able to listen to ActionEvents and also be able to [...]]]></description>
			<content:encoded><![CDATA[<p>Here I would like to demonstrate a simple use of JMenuItems being used with Single Listener for the entire system.<br />
A simple sample of use would probably be SingleInstance Desktop Application.</p>
<p>Lets see how that is done here.</p>
<p>1. First lets create a OneListener class that should be able to listen to ActionEvents and also be able to add Commands to itself. Please refer to my previous post on Command,Singleton if you would like to see more about this patterns and there usage.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
</pre></td><td class="code"><pre class="java"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.shaafshah.jmenus</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.event.ActionEvent</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.event.ActionListener</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.ArrayList</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.AbstractButton</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Implements the ActionListener and is a Singleton also.</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> OneListener <span style="color: #000000; font-weight: bold;">implements</span> <span style="color: #003399;">ActionListener</span><span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> OneListener oneListener <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Holds the list of all commands registered to this listener</span>
	<span style="color: #000000; font-weight: bold;">private</span> ArrayList<span style="color: #339933;">&lt;</span>Command<span style="color: #339933;">&gt;</span> commandList <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// A private constructor</span>
	<span style="color: #000000; font-weight: bold;">private</span> OneListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		commandList <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>Command<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Ensuring one instance.</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> OneListener getInstance<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>oneListener <span style="color: #339933;">!=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>	
			<span style="color: #000000; font-weight: bold;">return</span> oneListener<span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">return</span> oneListener <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> OneListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Add the command and add myself as the listener</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> addCommand<span style="color: #009900;">&#40;</span>Command command<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			commandList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span>command<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		    <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">AbstractButton</span><span style="color: #009900;">&#41;</span>command<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">addActionListener</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
	<span style="color: #666666; font-style: italic;">// All Events hit here.</span>
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> actionPerformed<span style="color: #009900;">&#40;</span><span style="color: #003399;">ActionEvent</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>Command<span style="color: #009900;">&#41;</span>e.<span style="color: #006633;">getSource</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">execute</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>In the above code, the addCommand method adds the command Object and adds a listener to it.<br />
Now how is that possible.<br />
Basically because I am categorizing my UI objects as Commands with in the system having some UI. And I am also assuming that these commands are Currently AbstractButton i.e. JMenuItem, JButton. Lets have a look at the Command Interface and its Implementation.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="java"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">interface</span> Command <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> execute<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And the implementation, note that the Command is an interface where as the class is still extending a UI object.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="java"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.swing.JMenuItem</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestCmd <span style="color: #000000; font-weight: bold;">extends</span> <span style="color: #003399;">JMenuItem</span> <span style="color: #000000; font-weight: bold;">implements</span> Command<span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> TestCmd<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Test&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		OneListener.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">addCommand</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> execute<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;HelloWorld&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Personally don&#8217;t like calling the OneListener in the constructor of the class but just for the sake of simplicity of this post I have left it that way. There are many different ways to omit it.</p>
<p>So the TestCmd is a JMenuItem but is also a Command and thats what the OneListener understands.<br />
As this commads Listener is also OneListener all ActionEvents are thrown there and from there only the Command.execute is called on.</p>
<p>So now you dont have to worry about what listeners are you in. The only thing you know is that when execute is called you need to do your stuff.</p>
<p>You can download the code from <a href='http://www.shaafshah.com/wp-content/uploads/2008/11/jmenus.zip'>Here</a>.</p>
<p>Hope this helps.</p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.shaafshah.com/2008/11/17/command-singleton-jmenuitem-jbutton-abstractbutton-one-listener-for-the-app/&amp;t=Command%2C+Singleton%2C+JMenuItem%2C+JButton%2C+AbstractButton+-+One+Listener+for+the+app&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.shaafshah.com/2008/11/17/command-singleton-jmenuitem-jbutton-abstractbutton-one-listener-for-the-app/&amp;title=Command%2C+Singleton%2C+JMenuItem%2C+JButton%2C+AbstractButton+-+One+Listener+for+the+app&amp;t=1 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.shaafshah.com/2008/11/17/command-singleton-jmenuitem-jbutton-abstractbutton-one-listener-for-the-app/&amp;title=Command%2C+Singleton%2C+JMenuItem%2C+JButton%2C+AbstractButton+-+One+Listener+for+the+app&amp;t=2 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Command%2C+Singleton%2C+JMenuItem%2C+JButton%2C+AbstractButton+-+One+Listener+for+the+app;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=small-votes></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.shaafshah.com/2008/11/17/command-singleton-jmenuitem-jbutton-abstractbutton-one-listener-for-the-app/'; tweetmeme_style = 'compact';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/11/17/command-singleton-jmenuitem-jbutton-abstractbutton-one-listener-for-the-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Continous Integration &#8211; A blast from the past</title>
		<link>http://www.shaafshah.com/2008/11/12/continous-integration-a-blast-from-the-past/</link>
		<comments>http://www.shaafshah.com/2008/11/12/continous-integration-a-blast-from-the-past/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 18:00:16 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[CI]]></category>
		<category><![CDATA[continous]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[scm]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=117</guid>
		<description><![CDATA[Although this didn&#8217;t happen a decade ago but still has been a good case for me to learn and realize how Continuous Integration brings value addition to our work.
As I recall it was like this when they were teenagers 
Few teams working on different modules of same application, deployed together.
No build process formalized
No builds except [...]]]></description>
			<content:encoded><![CDATA[<p>Although this didn&#8217;t happen a decade ago but still has been a good case for me to learn and realize how Continuous Integration brings value addition to our work.</p>
<p>As I recall it was like this when they were teenagers <img src='http://www.shaafshah.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /><br />
Few teams working on different modules of same application, deployed together.<br />
No build process formalized<br />
No builds except for the ones that need major milestone deployments.<br />
No feedback, reports, reviews etc.</p>
<p>So virtually there was no build eco system.</p>
<p>Which meant hideous amounts of communication, tons of trouble shooting, last minute show stoppers, And extermely unhappy end users/stake holders.</p>
<p>So what exactly was going wrong.</p>
<p>There was no Configuration Control i.e. No way to figure out the changes that will be part of the release and no controls to include or exclude them.<br />
No Status accounting i.e. No feedback or status of anything as a whole product.<br />
No management of Environment meant no one knew what hardware/software they were using and sometimes why?<br />
No team work whatsoever meant no guided processes, reviews or tracebility of issues and pitfalls.</p>
<p>So virtually a release day was the doomsday!</p>
<p>It took some time for developers to realize that how important the following were.<br />
    * Configuration identification &#8211; What code are we working with?<br />
    * Configuration control &#8211; Controlling the release of a product and its changes.<br />
    * Status accounting &#8211; Recording and reporting the status of components.<br />
    * Review &#8211; Ensuring completeness and consistency among components.<br />
    * Build management &#8211; Managing the process and tools used for builds.<br />
    * Process management &#8211; Ensuring adherence to the organization&#8217;s development process.<br />
    * Environment management &#8211; Managing the software and hardware that host our system.<br />
    * Teamwork &#8211; Facilitate team interactions related to the process.<br />
    * Defect tracking &#8211; Making sure every defect has traceability back to the source</p>
<p>And after all it takes some time but the day to day flow looked like the figure below.</p>
<div id="attachment_118" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.shaafshah.com/wp-content/uploads/2008/11/build.png"><img src="http://www.shaafshah.com/wp-content/uploads/2008/11/build-300x221.png" alt="Build Management" title="Continous Integration" width="300" height="221" class="size-medium wp-image-118" /></a><p class="wp-caption-text">Build Management</p></div>
<p>Importantly<br />
Developers are distributed on different locations in different teams.<br />
There is an SCM team that takes care of the SCM activities i.e. Configuration Identification, Control, Build Management etc.<br />
There is one single repository for all developers.<br />
A process is defined for Product integration and its checked whenever some one checks in.<br />
And hourly build is dont to check the sanity of the system with the unit tests.<br />
A Nightly build is done with all full blown unit tests, coverage reports, Automated tests and installers and upgrades.<br />
More over all of the above is shown on an FTP/HTTP site. FTP for installer/binary/archive pickup and HTTP for detailed view of builds/feedbacks etc.</p>
<p>All of the above meant strength and health of the build eco system. And more trust in the system that it will report failures along the way.</p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.shaafshah.com/2008/11/12/continous-integration-a-blast-from-the-past/&amp;t=Continous+Integration+-+A+blast+from+the+past&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.shaafshah.com/2008/11/12/continous-integration-a-blast-from-the-past/&amp;title=Continous+Integration+-+A+blast+from+the+past&amp;t=1 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.shaafshah.com/2008/11/12/continous-integration-a-blast-from-the-past/&amp;title=Continous+Integration+-+A+blast+from+the+past&amp;t=2 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Continous+Integration+-+A+blast+from+the+past;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=small-votes></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.shaafshah.com/2008/11/12/continous-integration-a-blast-from-the-past/'; tweetmeme_style = 'compact';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/11/12/continous-integration-a-blast-from-the-past/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Doing the Locale &#8211; Danmark</title>
		<link>http://www.shaafshah.com/2008/11/12/doing-the-locale-danmark/</link>
		<comments>http://www.shaafshah.com/2008/11/12/doing-the-locale-danmark/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 12:52:08 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[locale]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[utils]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=110</guid>
		<description><![CDATA[The following illustrates how to get the Number format working with a danish locale.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import java.text.NumberFormat;
import java.util.Currency;
import java.util.Locale;
&#160;
&#160;
public class TestLocale &#123;
&#160;
 public static void main&#40;String args&#91;&#93;&#41;&#123;
 // Create a Locale for Danmark
 Locale DANMARK = new Locale&#40;&#34;da&#34;,&#34;DK&#34;&#41;;
&#160;
 // get the currency instance for this locale.
 Currency krone = Currency.getInstance&#40;DANMARK&#41;;
&#160;
 // Get a Number format for the [...]]]></description>
			<content:encoded><![CDATA[<p>The following illustrates how to get the Number format working with a danish locale.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="java"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.text.NumberFormat</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Currency</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Locale</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestLocale <span style="color: #009900;">&#123;</span>
&nbsp;
 <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> args<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 <span style="color: #666666; font-style: italic;">// Create a Locale for Danmark</span>
 <span style="color: #003399;">Locale</span> DANMARK <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Locale</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;da&quot;</span>,<span style="color: #0000ff;">&quot;DK&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// get the currency instance for this locale.</span>
 Currency krone <span style="color: #339933;">=</span> Currency.<span style="color: #006633;">getInstance</span><span style="color: #009900;">&#40;</span>DANMARK<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// Get a Number format for the locale.</span>
 <span style="color: #003399;">NumberFormat</span> krFormat <span style="color: #339933;">=</span> <span style="color: #003399;">NumberFormat</span>.<span style="color: #006633;">getCurrencyInstance</span><span style="color: #009900;">&#40;</span>DANMARK<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #666666; font-style: italic;">// A symbol for the currency</span>
 <span style="color: #003399;">String</span> symbol <span style="color: #339933;">=</span> krFormat.<span style="color: #006633;">getCurrency</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getSymbol</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #666666; font-style: italic;">// A double amount</span>
 <span style="color: #000066; font-weight: bold;">double</span> amount <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10000.25</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// print it out after formatting.</span>
 <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>krFormat.<span style="color: #006633;">format</span><span style="color: #009900;">&#40;</span>amount<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.shaafshah.com/2008/11/12/doing-the-locale-danmark/&amp;t=Doing+the+Locale+-+Danmark&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.shaafshah.com/2008/11/12/doing-the-locale-danmark/&amp;title=Doing+the+Locale+-+Danmark&amp;t=1 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.shaafshah.com/2008/11/12/doing-the-locale-danmark/&amp;title=Doing+the+Locale+-+Danmark&amp;t=2 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Doing+the+Locale+-+Danmark;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=small-votes></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.shaafshah.com/2008/11/12/doing-the-locale-danmark/'; tweetmeme_style = 'compact';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/11/12/doing-the-locale-danmark/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>That thing about CI &#8211; Continous Integration</title>
		<link>http://www.shaafshah.com/2008/11/12/that-thing-about-ci-continous-integration/</link>
		<comments>http://www.shaafshah.com/2008/11/12/that-thing-about-ci-continous-integration/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 12:11:18 +0000</pubDate>
		<dc:creator>Shaaf Shah</dc:creator>
				<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[CI]]></category>
		<category><![CDATA[continous]]></category>
		<category><![CDATA[engineering]]></category>
		<category><![CDATA[integration]]></category>
		<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.shaafshah.com/?p=13</guid>
		<description><![CDATA[Challenging Business requirements and the need for software development teams to remain agile and competitive while managing parallel development and releases requires a system which is adaptive to these demands.
Our approach to SCM enables unlimited and adaptable process models, which are ideally suited for parallel, distributed, and agile software development. Using state of the Art [...]]]></description>
			<content:encoded><![CDATA[<p>Challenging Business requirements and the need for software development teams to remain agile and competitive while managing parallel development and releases requires a system which is adaptive to these demands.</p>
<p>Our approach to SCM enables unlimited and adaptable process models, which are ideally suited for parallel, distributed, and agile software development. Using state of the Art technologies from various vendors to automate processes such as branching, merging, build, and release keeps you a click away from software delivery.</p>
<p>The real matter then is the sanity of your application and that&#8217;s the challenge we all need to address. We can have cute products right of the shelf to get it up and going but the whole challenge lies in the statement &#8220;up and going&#8221;. It takes a ton of energy and effort to come up with the right process and the right tool. I have not seen alot of CI projects failing strictly. But I do have seen extra efforts into things that should not be really there. failure would then mean the amounts of efforts spent on doing not so trivial stuff and on the other end if you are spending alot of time doing the major flows then definately something is wrong.</p>
<p>Automation does solve most parts of the problems but things that really need to be taken care of to get it right in the sweet spot are the ones Martin Fowler described in one of his articles.</p>
<p>* <strong>Maintain a Single Source Repository</strong><br />
Keep everyone together, at the end of the day we all work together dont we?</p>
<p>* <strong>Automate the Build</strong><br />
Automation of the build helps you.</p>
<p>* <strong>Make Your Build Self-Testing</strong><br />
<strong></strong>Self testing build tells you exactly what you did and what you broke. So I can come up with this statement to my Lead. &#8220;If I commit this, it might break alot of stuff&#8221;. Well Sir, try running the Unit Test, You will know for sure! But then again honesty on the test cases really doest matter!</p>
<p>* <strong>Everyone Commits Every Day</strong><br />
Typically in a Agile environment helps alot, and forces you not to break the build. Better organization I must say.</p>
<p>* <strong>Every Commit Should Build the Mainline on an Integration Machine</strong><br />
Sanity checking of your commits. So often we commit without realiazing that we break something else.</p>
<p>* <strong>Keep the Build Fast</strong><br />
I usually commit before leaving for home. It helps great deal when you get the feedback within 5 mins. kind of a benchmark but depends.</p>
<p>* <strong>Make it Easy for Anyone to Get the Latest Executable</strong><br />
Keep all the build results and one sharable place. We did that on one of the http servers some time back</p>
<p>* <strong>Everyone can see what&#8217;s happening</strong><br />
Importantly that all results are published for all of us to know.</p>
<p>* <strong>Automate Deployment</strong><br />
Deployment automation means that my buddy X on the other side doesnt screw up the server for even a 1 min. Only deploys when build successfull.</p>
<p>Hope this helps.</p>
<p><strong>Resources:</strong></p>
<p><a title="http://martinfowler.com/articles/continuousIntegration.html" href="http://martinfowler.com/articles/continuousIntegration.html">http://martinfowler.com/articles/continuousIntegration.html</a></p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.shaafshah.com/2008/11/12/that-thing-about-ci-continous-integration/&amp;t=That+thing+about+CI+-+Continous+Integration&amp;s=compact' height='18' width='120' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.shaafshah.com/2008/11/12/that-thing-about-ci-continous-integration/&amp;title=That+thing+about+CI+-+Continous+Integration&amp;t=1 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.shaafshah.com/2008/11/12/that-thing-about-ci-continous-integration/&amp;title=That+thing+about+CI+-+Continous+Integration&amp;t=2 ' height='18' width='120' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=That+thing+about+CI+-+Continous+Integration;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=small-votes></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.shaafshah.com/2008/11/12/that-thing-about-ci-continous-integration/'; tweetmeme_style = 'compact';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.shaafshah.com/2008/11/12/that-thing-about-ci-continous-integration/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
