<?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>Gojko Adzic &#187; best practices</title>
	<atom:link href="http://gojko.net/tag/best-practices/feed/" rel="self" type="application/rss+xml" />
	<link>http://gojko.net</link>
	<description>Building software that matters</description>
	<lastBuildDate>Wed, 04 Aug 2010 11:38:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Dependency injection with Castle Windsor: Video</title>
		<link>http://gojko.net/2008/11/04/dependency-injection-with-castle-windsor-video/</link>
		<comments>http://gojko.net/2008/11/04/dependency-injection-with-castle-windsor-video/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 22:00:11 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[presentations]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[alt.net]]></category>
		<category><![CDATA[altdotnet]]></category>
		<category><![CDATA[altnetuk]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[castle]]></category>
		<category><![CDATA[dependency injection]]></category>
		<category><![CDATA[skills matter]]></category>
		<category><![CDATA[windsor]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=456</guid>
		<description><![CDATA[Here&#8217;s the video from the talk on dependency injection with Castle Windsor that Mike Hadlow and I did last month at Skills Matter. in the first part of the talk, Mike introduces Dependency Injection and explains how to apply that pattern in practice with Castle Windsor. Then he talks about Castle component lifestyles and implementing [...]]]></description>
			<content:encoded><![CDATA[<p><embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docid=5532485947135262592&#038;hl=en&#038;fs=true" style="width:400px;height:326px; margin:5px 5px 5px 5px;border:1px solid black;" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" align="left"></embed>Here&#8217;s the video from the talk on dependency injection with <a href="http://www.castleproject.org" target="_blank">Castle Windsor</a> that <a href="http://mikehadlow.blogspot.com/"  target="_blank">Mike Hadlow</a> and I did last month at <a href="http://www.skillsmatter.com"  target="_blank">Skills Matter</a>.</p>
<p>in the first part of the talk, Mike introduces Dependency Injection and explains how to apply that pattern in practice with Castle Windsor. Then he talks about Castle component lifestyles and implementing common architectural and design patterns using Castle Windsor component model. In the second part of the talk, I present strategies how to manage component configuration effectively for production. After that, I explain how to use Castle facilities to extend the framework, integrate third-party services and manage components easier.  </p>
<p><a href="http://gojko.net/2008/10/23/dependency-injection-with-castle-windsor-source-code-and-links/">download the slides and the source code from the talk</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/11/04/dependency-injection-with-castle-windsor-video/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using Fitnesse pages as templates</title>
		<link>http://gojko.net/2008/10/21/using-fitnesse-pages-as-templates/</link>
		<comments>http://gojko.net/2008/10/21/using-fitnesse-pages-as-templates/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 16:39:55 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[acceptance testing]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[fitnesse]]></category>
		<category><![CDATA[specification by example]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=426</guid>
		<description><![CDATA[I&#8217;m getting this question very often from web site readers, and I&#8217;ve decided to put the answer online because it deals with a crucial misconception about FitNesse and signals a really bad usage practice. The question appears in different shapes, mostly around templating or simplifying complex scripts. This is the latest version: I would like [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m getting this question very often from web site readers, and I&#8217;ve decided to put the answer online because it deals with a crucial misconception about FitNesse and signals a really bad usage practice. The question appears in different shapes, mostly around templating or simplifying complex scripts. This is the latest version:<span id="more-426"></span></p>
<blockquote><p>
I would like to know if we could used a Fitnesse page as a template. </p>
<p>We all know that Fitnesse offers ColumnFixture which allows us to make a loop within a wiki page. I understand that with a ColumnFixture, we could not run anything other than methods defined in that ColumnFixture. So if i need to run a test scenario over a set of parameters, i need to create a ColumnFixture, build a method which do all the work of the mentioned<br />
test scenario, then put the ColumnFixture on wiki page&#8230;. </p>
<p>The biggest disadvantages is that we have to develop something (the development curve could be expensive if the test scenario is  rather complex) for each test scenario. Any way, this advantage will be overcome if we have ability to use a wiki page as template. Here is detailed description of using wiki page as template: </p>
<p>1. Build a simple Column Fixture encapsulating all parameters used in a test scenario *and* the absolute path of the page representing a single test scenario </p>
<p>2. Put the ColumnFixture in a third Fitnesse test page, with tuples of parameters in rows  *and *the absolute path to test scenario page in question </p>
<p>3.Click on the &#8216;Test&#8217; button, then the wiki engine will run over all the table rows. For each row, tuple of parameters would be inserted into the template page specified by the absolute path. Then the filled template page would be executed as a normal Test page </p>
<p>4. The final test result will be collection of all..
</p></blockquote>
<p>There are several ways you can do this with FitNesse, including <a href="http://fitnesse.info/fixturegallery:importantconcepts:markupvariables">Markup Variables</a> and <a href="http://fitnesse.org/FitNesse.ParameterizedIncludes">Parameterised includes</a>, but the problem here is not how to do that, but why do you want to do it at all. Posing this questions seems to suggest that you are building scripts rather than a specification with Fitnesse. This is a very bad practice and it is going to cost you a lot on the long run.</p>
<p>Reusing fixture code or fixture tables is not something you should be concerned about if you are using FitNesse properly. FitNesse is not a general purpose test automation tool. It is not designed to be a test automation tool, it is designed to work with acceptance tests or executable specifications that are worked out together by the business, testers and developers. Such acceptance tests can and should be used for regression testing later, but FitNesse is not a general-purpose test tool. There are much better tools for that, and if you need UI automation testing, use one of such tools.</p>
<p>FitNesse is a very good tool for executable specifications. In order for executable specifications to be effective, they have to be easy to read and understand and they have to explain the system from the appropriate level of abstraction. Otherwise they are unusable as a target for development and they will be a pain to maintain, especially because code refactoring does not propagate to test pages. Having templates and complex scripts does not fall under the &#8220;easy to understand&#8221; category. Looking at things from the proper level of abstraction means grouping related rules and explaining them so that there is very little which really needs to be reused across different specifications.</p>
<p>You should encapsulate the script (your template) in fixture code, and then use the table with parameters and results in the fitnesse page connecting to that fixture to specify inputs and outputs. This difference between the script (<i>how</i>) and specification (<i>what</i>) is the key to successful application of acceptance testing. Details of scripts and their complexity should be put into fixtures (and don&#8217;t force yourself to use the ColumnFixture, take a look at the <a href="http://fitnesse.info/fixturegallery">fixture gallery</a> and see which fixture type is closest to what you want to achieve). FitNesse  tables should just provide inputs and expected outputs for entire scenarios, not dealing with individual workflow steps. Tests like that will be much easier to understand and maintain. Changes in code will be propagated to fixture code, so you will not suffer from high maintenance costs. <a href='http://blog.davidpeterson.co.uk/'>David Peterson</a> gives a very good example of the difference between Scripting and Specification on <a href='http://www.concordion.org/Technique.html'>Concordion Technique</a> page. The ideas described there are applicable to FitNesse as well.</p>
<p>Some testers complain that this requires developers to help them with writing fixtures. If you do not work together with developers, then you are not doing agile acceptance testing properly and there is no chance that the whole thing will actually work. So not having developers on board is a much larger problem than the one of writing fixtures to automate your tests. Again, this may signal that you are not using FitNesse for <a href="http://www.acceptancetesting.info">agile acceptance testing</a> but just for test automation, and there are much better tools for that. Use the right tool for the job, don&#8217;t treat FitNesse (or anything else) as the silver bullet that solves all problems. </p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/10/21/using-fitnesse-pages-as-templates/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Beware of the second worst programmer</title>
		<link>http://gojko.net/2008/10/07/beware-of-the-second-worst-programmer/</link>
		<comments>http://gojko.net/2008/10/07/beware-of-the-second-worst-programmer/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 17:45:47 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[code reviews]]></category>
		<category><![CDATA[ddd]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=399</guid>
		<description><![CDATA[I attended a Domain Driven Design course on Monday at Skills Matter offices. Eric Evans led the course and put forward a very interesting theory that the quality of a software system is proportional to the skills of the second worst programmer. The explanation for the idea is that everyone on the team knows who [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/images/719761_beware.jpg" style="border:1px solid black;margin:5px 5px 5px 5px" align="left"/>I attended a <a target="_blank" href="http://skillsmatter.com/course/open-source-dot-net/domain-driven-design">Domain Driven Design</a> course on Monday at Skills Matter offices. Eric Evans led the course and put forward a very interesting theory that the quality of a software system is proportional to the skills of the second worst programmer.<span id="more-399"></span></p>
<p>The explanation for the idea is that everyone on the team knows who the worst programmer is, so senior developers are closely monitoring everything that he does and cleaning up problems. The work of the second worst programmer is not monitored with that attention so he has the chance to do some real damage. </p>
<p>Although the story was intended as a joke, it is not completely without merit. Of course, just watching that person as well is not going to solve the problem. The moral of the story is, I think, that code and design reviews need to be done periodically. Most teams I&#8217;ve worked with in the past don&#8217;t take code reviews seriously, but that is one of the key practices to prevent problems and should not be skipped. Pair programming helps a lot since at least two people are working on the same task, but it still does not protect against problematic code (especially if the worst and the second worst guy pair up). </p>
<p>Drawing a parallel between writing and coding, proof-readers and copy-editors play a crucial role in any magazine or publishing company. They look at the stuff that you have written, identify and sort out (or suggest sorting out) language and grammar issues and look out for stuff that is expressed overly complicated and should be made more clear. An impartial view on the stuff that an author has written often helps a lot to make his text easier to understand and read. </p>
<p>Code reviews matter. Do them often, read code that other people wrote and get them to read your code. Step back for a moment and switch to reading mode rather than writing and check if the stuff can be written simpler or better.  Even with the best intentions, people sometimes get blind to unnecessary complexity that they wrote themselves and an objective opinion of another developer can help a lot to sort things like that out. And of course, they might spot things that you have missed while writing the code, intercept bugs and suggest additional unit tests to check potential problems.</p>
<p>Image credits: <a href="http://www.sxc.hu/profile/buzzybee" target="_blank">Jenny Rollo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/10/07/beware-of-the-second-worst-programmer/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>10 ways to screw up despite Scrum and XP</title>
		<link>http://gojko.net/2008/08/06/10-ways-to-screw-up-despite-scrum-and-xp/</link>
		<comments>http://gojko.net/2008/08/06/10-ways-to-screw-up-despite-scrum-and-xp/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 15:46:56 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[agile2008]]></category>
		<category><![CDATA[anti-patterns]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[scrum]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=214</guid>
		<description><![CDATA[Henrik Kniberg, author of Scrum and Xp from the Trenches, talked today at Agile 2008 about the most common ways for teams to fail despite applying agile practices and tools. His presentation was organised as a talk about common problems and symptoms of those problems, with audience voting on what hurts them the most. From [...]]]></description>
			<content:encoded><![CDATA[<p>Henrik Kniberg, author of Scrum and Xp from the Trenches, talked today at Agile 2008 about the most common ways for teams to fail despite applying agile practices and tools. His presentation was organised as a talk about common problems and symptoms of those problems, with audience voting on what hurts them the most. From my perspective, it was a very effective way to see problems of other teams and definitely raised the awareness of some of these issues.  <span id="more-214"></span></p>
<p>The audience voted by raising coloured cards. A green card signaled that a particular issue was not really hurting the voter, a yellow card signaled that it hurts a bit and a red card meant that the issue was a serious problem.</p>
<p>Here are the things that Kniberg talked about:</p>
<ol>
<li>Believing the hype (mostly yellow cards)
<ul>
<li>belief in magic  &mdash; “all the problems will magically go away when we install XP 1.0”</li>
<li>not willing to change  &mdash; “trying to chop the tree with a chainsaw”</li>
<li>throwing out stuff that works</li>
<li>focusing too much on process perfection</li>
<li>trying to get it all right from start</li>
<li>blaming the messenger &mdash; scrum flushes out problems in the open</li>
<li>tool focus &mdash;”let&#8217;s buy the biggest most expensive XP tool”</li>
<li>focusing on the wrong issues (should we use postits or index cards)</li>
</ul>
</li>
<li>Definition of done (mostly yellow and red cards)
<ul>
<li>not having one</li>
<li>not obeyng it</li>
<li>it&#8217;s outside the teams control (in production, but team has no access to it)</li>
</ul>
</li>
<li>Velocity issues (mixed – yellow, green and red)
<ul>
<li>it&#8217;s not known</li>
<li>it&#8217;s not used</li>
<li>is misused (connected to salary)</li>
<li>death marches</li>
<li>cheating</li>
<li>yo-yo velocity &mdash; bugs leaking into other iterations</li>
</ul>
</li>
<li>Retrospective problems (mixed – yellow, green and red)
<ul>
<li>doesn&#8217;t happen</li>
<li>doesn&#8217;t result in concrete improvements</li>
<li>changes not executed and evaluated</li>
<li>unwanted people in the meeting – team not open </li>
<li>team members or product owner not participating</li>
<li>team is penalised for bad changes</li>
</ul>
</li>
<li>Team commitment issues (more red than anything else, but mostly yellow)
<ul>
<li>team is pressured – deadlines, death marches, aggressive managers</li>
<li>team is not sitting together</li>
<li>team does not track and learn</li>
<li>always under-committing</li>
<li>always over-committing</li>
<li>velocity=0 &mdash;nothing actually delivered to the end</li>
<li>no slack</li>
</ul>
</li>
<li>Technical debt (mostly red)
<ul>
<li>letting it pile up</li>
<li>ignoring it</li>
<li>fixing the product but not the process</li>
<li>big bang rewrites</li>
</ul>
</li>
<li>Teamwork issues (yellow-red)
<ul>
<li>fixed roles &mdash; “I don&#8217;t touch your stuff ever”</li>
<li>personal backlogs</li>
<li>people not helping each other</li>
<li>personal incentive models</li>
<li>implementing all stories in parallel</li>
<li>management interference</li>
</ul>
</li>
<li>Product backlog and product owner/customer issues (mostly red cards)
<ul>
<li>not having a backlog</li>
<li>having backlog but not visible</li>
<li>big or never-ending stories</li>
<li>product owner does not have power or domain knowledge</li>
<li>multiple, conflicting product owners</li>
<li>product backlog not being maintained</li>
<li>product owner surprised at sprint demo</li>
<li>product owner is a bottleneck</li>
<li>product owner not prioritising</li>
</ul>
</li>
<li>Mergofobia &mdash; merging is a pain and therefore we do it as seldom as possible (mixed colours)
<ul>
<li>no “done” branch</li>
<li>no branch policies &mdash; purpose of each branch not clearly defined</li>
<li>not integrating early and often</li>
<li>not taking responsibility</li>
<li>hiding behind branches &mdash; “whenever we have a problem, we add a new branch”</li>
</ul>
</li>
<li>Sprint backlog/taskboard (relatively mixed, mostly yellow)
<ul>
<li>does not exist</li>
<li>too far from the team</li>
<li>too complicated &mdash; &#8220;too many columns&#8221;</li>
<li>not used during daily scrum</li>
<li>not owned by he team &mdash; tool or way of maintenance imposed from above</li>
<li>no burndowns</li>
<li>not updated daily</li>
<li>warning signes ignored</li>
</ul>
</li>
</ol>
<p>From the votes, it looks like technical debt and product backlog and product owner/customer issues are the biggest problems for most teams</p>
<p>An interesting thing happened at the start of the talk, when Kniberg asked the audience to vote on “this conference is too big”, with most people raising red cards. From what I can work out, at any time there are at least 30 sessions running concurrently and it is often a challenge to select a single session to attend.</p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/08/06/10-ways-to-screw-up-despite-scrum-and-xp/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Clean your HTML inputs or the dog-eaters will get to you</title>
		<link>http://gojko.net/2008/06/23/clean-your-html-inputs-or-the-dog-eaters-will-get-to-you/</link>
		<comments>http://gojko.net/2008/06/23/clean-your-html-inputs-or-the-dog-eaters-will-get-to-you/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 16:52:27 +0000</pubDate>
		<dc:creator>gojko</dc:creator>
				<category><![CDATA[articles]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://gojko.net/?p=142</guid>
		<description><![CDATA[Last month, I took a short break from my computer and went on a holiday. When I came back I was surprised to find that, while I was on the beach, Google sent quite a few people looking for underground Korean adult movies to my web log. I don&#8217;t know what is so special about [...]]]></description>
			<content:encoded><![CDATA[<p><img src="/images/983892_dishwasher_cube_2.jpg" align="left" style="border: 1px solid black; margin:5px 5px 5px 5px" />Last month, I took a short break from my computer and went on a holiday. When I came back I was surprised to find that, while I was on the beach, Google sent quite a few people looking for underground Korean adult movies to my web log. I don&#8217;t know what is so special about the Korean illegal film industry, but considering that they also eat dogs there, it must be something very interesting to watch. I guess that you can find anything on Internet these days, but why were they looking for it on my web site? The answer to that question turned out to be another great example of why inputs should be sanitised no matter how unimportant. <span id="more-142"></span></p>
<p>I use WordPress for my blog, and so far I am relatively satisfied with it. As a very popular online software package, it does get attacked a lot and security updates are released every once in a while. My site was hacked last year and the bastards dumped a bunch of hidden porn site links in about twenty articles, which took me a few days to clear up. So I learned the hard way that when the admin console suggests an upgrade, I should take its advice. I also added a cron task to check for a few keywords in the database and alert me if someone starts advertising limb enlargement devices for free, and since then I had no real problems. That is, until my site became a hot spot for south-east Asian smut aficionados overnight. </p>
<p>My first guess was that someone was simply spamming me with fake referrer headers, since there was absolutely no reason why my web site would actually appear in Google&#8217;s search results for adult movies, Korean or with a different geographic origin. Web sites use request referrer headers to identify where the visitors are coming from. A web browser will send the address of the site where you click on a link to the linked web site, if you have not turned that off. It is not a 100% reliable mechanism to identify visitor sources, as some people turn that feature off and some browsers have bugs and send rubbish, but in general it works OK. With the recent surge in the number of blogs, a new kind of spamming started to take place online. Spammers send fake requests to web sites, putting the address of the web site they are advertising into the referrer header. The rationale behind it is, I guess, to make the site owners to click on the referrer link to see who is sending people to their web site. </p>
<p>But there were quite a few of those requests, much more than with typical spam. The visitors were led to the search web page, and did not look at any other page after that, which could be explained by the fact that they were probably disappointed to find only clips of an ugly bald guy talking about agile acceptance testing instead of their favourite underground adult stars. However, with the web page they downloaded images, css and javascript files, which spammers typically don&#8217;t do. I did not know which article actually brought the unexpected guests since only the search page was affected. The database lookup did not help either &mdash; luckily this time it seemed that the site was not hacked.</p>
<p>I tried out the query on Google, just for fun, to be absolutely amazed that my site was the third on the list. Sure enough, my search page was there. I simply had to click on that to see what happens, and a few seconds later I was looking at a spam web site. My web logs showed a hit from Google again, but I was not looking at my site. Clicking on the “cached” link on Google led to the same outcome. I grabbed the page using wget, which definitely would not jump out directly, and there I found the words “korean underground adult movies”, but only after the “There are no results for&#8230;” phrase. More interesting, after that, there was a HTML image tag with “-1.com” as the source, and an onError event redirecting people to the spam web site. When the page loaded, the browser could not find -1.com to load the picture, and fired the onError event, sending the visitors from my web site to some place they could probably watch something more to their liking. Not a bad trick at all!</p>
<p>God knows how they got Google to index my web page with both their keywords and the redirection tag as a search phrase, but they did. And it&#8217;s not only my blog, there&#8217;s a few thousand other sites with the same problem. Search on google for “onerror freeimagew” to see them.  The results containing &lt;/title&gt; in the site name will probably redirect you automatically to the spam site. </p>
<p><img src="/images/979452_clean_it_3.jpg" align="right" style="border: 1px solid black; margin:5px 5px 5px 5px" /> The problem was that my blog just dumped out whatever people put into the search form when it could not find any relevant posts. The input string was properly sanitised before it was sent to the database, and WordPress generally cleans up all user submitted comments from hostile content, but it looks like they did not think of someone using the search form to hack the web site. In any case, I just changed the theme search.php file to print “Sorry, no posts matched your criteria” when there are no results, and that fixed the problem. A proper solution would be to strip out HTML tags from the search but I was too lazy to look for all the places where the phrase could be set.</p>
<p>In any case, this is one more example how important it is to filter and sanitise everything put in by web site users, regardless of how safe it may seem, and never ever printing it back on the web site without checking for potential problems. </p>
<p>Image credits: <a href="http://www.sxc.hu/profile/lusi" target="_blank">Sonja Gjenero</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gojko.net/2008/06/23/clean-your-html-inputs-or-the-dog-eaters-will-get-to-you/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
