<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><!-- generator="wordpress/1.5.1-alpha" --><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>temujin, the fabulous freak...</title>
	<link>http://temujin.blogsome.com</link>
	<description>From Software Development to Photography with a few other things in between</description>
	<pubDate>Fri, 25 Sep 2009 15:00:23 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5.1-alpha</generator>
	<language>en</language>

		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/temujinBlogDev" /><feedburner:info uri="temujinblogdev" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>Spam really gets everywhere, even dotnetkicks</title>
		<link>http://temujin.blogsome.com/2009/02/25/spam-really-gets-everywhere-even-dotnetkicks/</link>
		<comments>http://temujin.blogsome.com/2009/02/25/spam-really-gets-everywhere-even-dotnetkicks/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 18:15:38 +0000</pubDate>
		<dc:creator>João Almeida</dc:creator>
		
	<category>.net</category>
	<category>internet</category>
		<guid>http://temujin.blogsome.com/2009/02/25/spam-really-gets-everywhere-even-dotnetkicks/</guid>
		<description><![CDATA[	 
	Spam really gets everywhere, the screenshot on the right is from the Tags box in the front page of DotNetKicks, a Digg-like online community dedicated to .Net programmers.
	&#160;
	&#160;
	&#160;
	&#160;
	&#160;
	Technorati Tags: dotnetkicks,spam
]]></description>
			<content:encoded><![CDATA[	<p><img style="border-right-width: 0px; margin: 0px 25px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="dotnetkicks" border="0" alt="dotnetkicks" align="left" src="http://temujin.blogsome.com/images/dotnetkicks.png" width="121" height="244" /> </p>
	<p><a href="http://en.wikipedia.org/wiki/Spam_(electronic)" target="_blank">Spam</a> really gets everywhere, the screenshot on the right is from the Tags box in the front page of <a href="http://www.dotnetkicks.com/" target="_blank">DotNetKicks</a>, a Digg-like online community dedicated to <a href="http://www.microsoft.com/NET/" target="_blank">.Net</a> programmers.</p>
	<p>&#160;</p>
	<p>&#160;</p>
	<p>&#160;</p>
	<p>&#160;</p>
	<p>&#160;</p>
	<h6>Technorati Tags: <a href="http://technorati.com/tags/dotnetkicks" rel="tag">dotnetkicks</a>,<a href="http://technorati.com/tags/spam" rel="tag">spam</a></h6>
]]></content:encoded>
			<wfw:commentRss>http://temujin.blogsome.com/2009/02/25/spam-really-gets-everywhere-even-dotnetkicks/feed/</wfw:commentRss>
	</item>
		<item>
		<title>on unity injection attributes</title>
		<link>http://temujin.blogsome.com/2009/02/11/on-unity-injection-attributes/</link>
		<comments>http://temujin.blogsome.com/2009/02/11/on-unity-injection-attributes/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 20:11:28 +0000</pubDate>
		<dc:creator>João Almeida</dc:creator>
		
	<category>.net</category>
		<guid>http://temujin.blogsome.com/2009/02/11/on-unity-injection-attributes/</guid>
		<description><![CDATA[	Unity is a pretty neat piece of work, it&#8217;s a simple and straightforward dependency injection container and it gets the job done, which is all you want from any implementation like this. 
	If someone&#8217;s trying to go beyond the &#8220;get an implementation instance for a given interface&#8221; examples found in most of the tutorials then [...]]]></description>
			<content:encoded><![CDATA[	<p><a href="http://www.codeplex.com/unity" target="_blank">Unity</a> is a pretty neat piece of work, it&#8217;s a simple and straightforward <a href="http://martinfowler.com/articles/injection.html" target="_blank"><em>dependency injection</em></a> container and it gets the job done, which is all you want from any implementation like this. </p>
	<p>If someone&#8217;s trying to go beyond the &#8220;get an implementation instance for a given interface&#8221; examples found in most of the tutorials then proper <em>dependency injection</em> will be the way to go. This means returning the proper instance for the given interface, but also properly the objects that instance needs, and also the objects needed by those objects, and this could go on forever. Unity can do this almost automatically, but to do so it may need <em>hints</em> on how objects should be created, specially to choose the right constructor when multiple are available (by default will choose the <em>fatest</em> of them all). </p>
	<p>One of the ways this problem is solved is using an <a href="http://msdn.microsoft.com/en-us/library/dd203129.aspx" target="_blank">attribute that indicates which constructor should be used</a> (the same is valid for either <a href="http://msdn.microsoft.com/en-us/library/dd203147.aspx" target="_blank">properties</a> and <a href="http://msdn.microsoft.com/en-us/library/dd203161.aspx" target="_blank">method calls</a>), as shown below:</p>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; height: 18px; font-size: 12px"><span style=\"color: #0000ff\">public</span> <span style=\"color: #0000ff\">class</span> MyClass
</pre>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; height: 20px; font-size: 12px">{
</pre>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; height: 20px; font-size: 12px">  <span style=\"color: #0000ff\">public</span> MyObject(SomeOtherClass myObjA)
</pre>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; height: 19px; font-size: 12px">  {
</pre>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; height: 20px; font-size: 12px">    ...
</pre>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; height: 22px; font-size: 12px">  }
</pre>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
	<pre style="background-color: #f9fbb3; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; height: 24px; font-size: 12px">  [InjectionConstructor]
</pre>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; height: 19px; font-size: 12px">  <span style=\"color: #0000ff\">public</span> MyObject(MyDependentClass myObjB)
</pre>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; height: 21px; font-size: 12px">  {
</pre>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; height: 19px; font-size: 12px">    ...
</pre>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; height: 18px; font-size: 12px">  }
</pre>
	<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">} </pre>
	<p>The problem is: Unity, and all other dependency injection containers, want to solve a simple issue: reduce coupling between modules, classes, etc. That&#8217;s achieved by removing the dependency to the proper implementation, you only have to know the contract to use (the interface) and the dependency injection container will return the proper implementation, whatever that may be. But, by doing this we&#8217;re adding another dependency: to the dependency injection container implementation (like Unity), and while this is reasonable for the class that needs to use the container is not so reasonable for the classes the container will use. </p>
	<p>Take the code sample above: <em>MyClass</em> is just a plain class, by adding the <em>InjectionConstructor</em> attribute we&#8217;re adding a needless dependency because that class will never use Unity, it will be used by Unity. For me using this can be a design flaw that goes against what dependency injection is supposed to achieve. A safer, but more time consuming, way to get around this is to explicitly configure those dependencies (either in <a href="http://msdn.microsoft.com/en-us/library/dd203225.aspx" target="_blank">design time</a> or <a href="http://msdn.microsoft.com/en-us/library/dd203208.aspx" target="_blank">run time</a>) instead of letting Unity try to figure them out.</p>
	<p>&nbsp;</p>
	<h6>Technorati Tags: <a href="http://technorati.com/tags/microsoft" rel="tag">microsoft</a>,<a href="http://technorati.com/tags/enterprise+library" rel="tag">enterprise library</a>,<a href="http://technorati.com/tags/dependency+injection" rel="tag">dependency injection</a>,<a href="http://technorati.com/tags/unity" rel="tag">unity</a>,<a href="http://technorati.com/tags/ioc" rel="tag">ioc</a></h6>
<span class="sbmLink"></p>
	<table cellspacing="1" cellpadding="1">
	<tbody>
	<tr>
	<td class="sbmText">
	<h6>Share this:&nbsp; </h6>
</td>
	<td>
	<h6><a title="Post it to MSDN!" href="http://social.msdn.microsoft.com/en-us/action/create/s/E/?url=http://temujin.blogsome.com/2009/02/11/on-unity-injection-attributes/&amp;ttl=On Unity Injection Attributes" target="_blank"><img border="0" src="http://www.dotnetscraps.com/dotnetscraps/samples/sbmtool/msdn.png"/></a></h6>
	</td>
	<td>
	<h6><a title="Post it to del.icio.us" href="http://del.icio.us/post?url=http://temujin.blogsome.com/2009/02/11/on-unity-injection-attributes/&amp;;title=On Unity Injection Attributes" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/deliciou4.png"/></a></h6>
	</td>
	<td>
	<h6><a title="Post it to digg" href="http://digg.com/submit?phase=2&amp;url=http://temujin.blogsome.com/2009/02/11/on-unity-injection-attributes/&amp;title=On Unity Injection Attributes" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/digg14.png"/></a></h6>
	</td>
	<td>
	<h6><a title="Post it to dotnetkicks" href="http://www.dotnetkicks.com/kick/?url=http://temujin.blogsome.com/2009/02/11/on-unity-injection-attributes/&amp;title=On Unity Injection Attributes" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/CropperCapture154.jpg"/></a></h6>
	</td>
	<td>
	<h6><a title="Post it to reddit!" href="http://reddit.com/submit?url=http://temujin.blogsome.com/2009/02/11/on-unity-injection-attributes/&amp;title=On Unity Injection Attributes" target="_blank"><img border="0" src="http://blogs.msdn.com/blogfiles/rahulso/WindowsLiveWriter/IconsfordifferentSocialBookmarkingSites_B387/reddit4.png"/></a></h6>
</td>
</tr>
</tbody>
</table>
</span>
</p>
]]></content:encoded>
			<wfw:commentRss>http://temujin.blogsome.com/2009/02/11/on-unity-injection-attributes/feed/</wfw:commentRss>
	</item>
		<item>
		<title>…because Agile is more than Daily Scrums</title>
		<link>http://temujin.blogsome.com/2008/11/20/because-agile-is-more-than-daily-scrums/</link>
		<comments>http://temujin.blogsome.com/2008/11/20/because-agile-is-more-than-daily-scrums/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 16:03:14 +0000</pubDate>
		<dc:creator>João Almeida</dc:creator>
		
	<category>agile</category>
	<category>scrum</category>
		<guid>http://temujin.blogsome.com/2008/11/20/because-agile-is-more-than-daily-scrums/</guid>
		<description><![CDATA[	Oh, and it also has a few mechanical things about a monthly Sprint and daily Scrum. Trivial stuff compared to the rest. But guess which part people adopt? That&#8217;s right&#8211;Sprints and Scrums. Rapid cycles, but none of the good stuff that makes rapid cycles sustainable.James Shore: The Decline and Fall of Agile
Doing Daily Scrums, Sprint [...]]]></description>
			<content:encoded><![CDATA[	<blockquote><p><i>Oh, and it also has a few mechanical things about a monthly Sprint and daily Scrum. Trivial stuff compared to the rest. But guess which part people adopt? That&#8217;s right&#8211;Sprints and Scrums. Rapid cycles, but none of the good stuff that makes rapid cycles sustainable.</i><br /><a href="http://jamesshore.com/Blog/The-Decline-and-Fall-of-Agile.html">James Shore: The Decline and Fall of Agile</a></blockquote>
<br />Doing <i>Daily Scrums</i>, <i>Sprint Plannings</i> and all those Agile related &#8220;ceremonies&#8221; won&#8217;t improve the process in any way, without a proper background (good team communication, choosing the right best practices, etc.) those &#8220;ceremonies&#8221; will only help to point the team&#8217;s flaws.
</p>
]]></content:encoded>
			<wfw:commentRss>http://temujin.blogsome.com/2008/11/20/because-agile-is-more-than-daily-scrums/feed/</wfw:commentRss>
	</item>
		<item>
		<title>The Future of WCF</title>
		<link>http://temujin.blogsome.com/2008/11/19/the-future-of-wcf/</link>
		<comments>http://temujin.blogsome.com/2008/11/19/the-future-of-wcf/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 11:20:11 +0000</pubDate>
		<dc:creator>João Almeida</dc:creator>
		
	<category>.net</category>
	<category>soa</category>
	<category>web services</category>
		<guid>http://temujin.blogsome.com/2008/11/19/the-future-of-wcf/</guid>
		<description><![CDATA[	&#8220;WCF started with a clear bias towards SOAP, WS-* protocols, and other heavyweight standards that were being popularized at the time but had not been ubiquitously adopted.(&#8230;)I didn&#8217;t believe though that you could force the world to use a single approach for building web services.&#8221;Nicholas Allen
Windows Communication Foundation has to be one of the most [...]]]></description>
			<content:encoded><![CDATA[	<blockquote><p><i>&#8220;WCF started with a clear bias towards SOAP, WS-* protocols, and other heavyweight standards that were being popularized at the time but had not been ubiquitously adopted.<br />(&#8230;)<br />I didn&#8217;t believe though that you could force the world to use a single approach for building web services.&#8221;</i><br /><a target="_blank" href="http://blogs.msdn.com/drnick/default.aspx">Nicholas Allen</a><br /></blockquote>
<a target="_blank" href="http://en.wikipedia.org/wiki/Windows_Communication_Foundation">Windows Communication Foundation</a> has to be one of the most interesting pieces of the <a target="_blank" href="http://en.wikipedia.org/wiki/.NET_Framework"><i>.Net</i></a> universe released in recent years, mostly for being a huge improvement over the previous <a target="_blank" href="http://keithelder.net/blog/archive/2008/10/17/WCF-vs-ASMX-WebServices.aspx"><i>web service</i> model in <i>.Net</i></a>. So when one the minds behind <i>WCF</i> writes about the framework&#8217;s future it&#8217;s certainly worth a closer look.</p>
	<p><b><a href="http://blogs.msdn.com/drnick/archive/2008/11/13/the-future-of-wcf-part-1.aspx" target="_blank">The Future of WCF, Part 1</a><br /><a href="http://blogs.msdn.com/drnick/archive/2008/11/14/the-future-of-wcf-part-2.aspx" target="_blank">The Future of WCF, Part 2</a></b>
</p>
]]></content:encoded>
			<wfw:commentRss>http://temujin.blogsome.com/2008/11/19/the-future-of-wcf/feed/</wfw:commentRss>
	</item>
		<item>
		<title>A programmer’s fate…</title>
		<link>http://temujin.blogsome.com/2008/08/29/a-programmers-fate/</link>
		<comments>http://temujin.blogsome.com/2008/08/29/a-programmers-fate/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 15:31:40 +0000</pubDate>
		<dc:creator>João Almeida</dc:creator>
		
	<category>development</category>
		<guid>http://temujin.blogsome.com/2008/08/29/a-programmers-fate/</guid>
		<description><![CDATA[	 

]]></description>
			<content:encoded><![CDATA[	<p><embed src="http://blip.tv/play/gYwjwZJqjdEh" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="390"> </embed>
</p>
]]></content:encoded>
			<wfw:commentRss>http://temujin.blogsome.com/2008/08/29/a-programmers-fate/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Hero Anti-Pattern</title>
		<link>http://temujin.blogsome.com/2008/08/22/hero-anti-pattern/</link>
		<comments>http://temujin.blogsome.com/2008/08/22/hero-anti-pattern/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 15:51:16 +0000</pubDate>
		<dc:creator>João Almeida</dc:creator>
		
	<category>development</category>
	<category>agile</category>
		<guid>http://temujin.blogsome.com/2008/08/22/hero-anti-pattern/</guid>
		<description><![CDATA[	
	Hero Pattern 

	One popular solution to the operation issue is a Hero who can and often will manage the bulk of the operational needs. The Hero Pattern can work in a small environment when one individual has the talent and capacity to understand an entire system, including the many nuances required to keep it functioning [...]]]></description>
			<content:encoded><![CDATA[	</p>
	<blockquote><p style="font-style: italic;" class="MsoNormal"><span style="font-weight: bold;">Hero Pattern </span>
</p>
	<p style="font-style: italic;" class="MsoNormal">One popular solution to the operation issue is a Hero who can and often will manage the bulk of the operational needs. The Hero Pattern can work in a small environment when one individual has the talent and capacity to understand an entire system, including the many nuances required to keep it functioning properly. For a large system of many components this approach does not scale, yet it is one of the most frequently-deployed solutions.<o :p></o></p>
	<p style="font-style: italic;" class="MsoNormal">The Hero often understands service dependencies when no formal specification exists, remembers how to toggle features on and off or knows about systems everyone else has forgotten. The Hero is crucial but the Hero should not be an individual.<o :p></o></p>
	<p class="MsoNormal"><span style="font-style: italic;">I believe the best solution to the Hero Pattern is automation. However, it also helps simply to rotate individuals from team to team if the organization has the capacity. In banking, it&#8217;s sometimes mandatory to take vacation so any &#8220;I&#8217;ll just run this from my workstation&#8221; activities can be brought to light.</span>
</p></blockquote>
	<blockquote><p><a style="font-weight: bold;" href="http://www.infoq.com/articles/scalability-worst-practices">Scalability Worst Practices [</a><a style="font-weight: bold;" href="http://www.infoq.com/articles/scalability-worst-practices">InfoQ</a><a style="font-weight: bold;" href="http://www.infoq.com/articles/scalability-worst-practices">]</a>
</p></blockquote>
	<p class="MsoNormal"><span style="font-style: italic;"></span><o :p></o></p>
	<p><a href="http://www.infoq.com/articles/scalability-worst-practices" target="_blank"><span style="font-weight: bold;"></span></a>Lately I&#8217;ve faced this pattern, or maybe <a href="http://en.wikipedia.org/wiki/Anti-pattern" target="_blank">anti-pattern</a>, more times than I &#8216;d like to, either for lingering around a &#8220;hero&#8221; or even being one. My experience tells me that Agile practices like Scrum, although never addressing it explicitly, when properly implemented can minimize this problem.
</p>
]]></content:encoded>
			<wfw:commentRss>http://temujin.blogsome.com/2008/08/22/hero-anti-pattern/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Eclipse Ganymede is out.</title>
		<link>http://temujin.blogsome.com/2008/06/25/eclipse-ganymede-is-out/</link>
		<comments>http://temujin.blogsome.com/2008/06/25/eclipse-ganymede-is-out/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 16:27:38 +0000</pubDate>
		<dc:creator>João Almeida</dc:creator>
		
	<category>java</category>
	<category>eclipse</category>
	<category>open source</category>
		<guid>http://temujin.blogsome.com/2008/06/25/eclipse-ganymede-is-out/</guid>
		<description><![CDATA[	The Eclipse Project is home to a quite reasonable amount of sub projects, the list keeps growing every year, so to help the end-user the Eclipse Foundation arranges a simultaneous yearly release of Eclipse and all sub projects. Ganymede is the 2008 release, following Europa in 2007 and Callisto in 2006, and it contains Eclipse&#8217;s [...]]]></description>
			<content:encoded><![CDATA[	<p>The <a href="http://en.wikipedia.org/wiki/Eclipse_%28software%29">Eclipse</a> Project is home to a <a href="http://www.eclipse.org/projects/listofprojects.php">quite reasonable amount of sub projects</a>, the list keeps growing every year, so to help the end-user the <a href="http://en.wikipedia.org/wiki/Eclipse_Foundation">Eclipse Foundation</a> arranges a simultaneous yearly release of Eclipse and all sub projects. <a href="http://www.eclipse.org/ganymede/" target="_blank">Ganymede</a> is the 2008 release, following <a href="http://www.eclipse.org/europa/">Europa</a> in 2007 and <a href="http://www.eclipse.org/callisto/">Callisto</a> in 2006, and it contains Eclipse&#8217;s latest version (<a target="_blank" href="http://www.eclipse.org/eclipse/development/eclipse_project_plan_3_4.html">3.4</a>).</p>
	<p><b><a href="http://www.eclipse.org/ganymede/">Eclipse Ganymede</a></b><br />
<blockquote></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://temujin.blogsome.com/2008/06/25/eclipse-ganymede-is-out/feed/</wfw:commentRss>
	</item>
		<item>
		<title>The Perils of GetHashCode, continued…</title>
		<link>http://temujin.blogsome.com/2008/05/30/the-perils-of-gethashcode-continued/</link>
		<comments>http://temujin.blogsome.com/2008/05/30/the-perils-of-gethashcode-continued/#comments</comments>
		<pubDate>Fri, 30 May 2008 13:18:25 +0000</pubDate>
		<dc:creator>João Almeida</dc:creator>
		
	<category>.net</category>
		<guid>http://temujin.blogsome.com/2008/05/30/the-perils-of-gethashcode-continued/</guid>
		<description><![CDATA[	Some time ago I wrote about GetHashCode method and now Paulo Morgado has also faced some &#8220;hash related&#8221; issues to deal with (also in Portuguese). Again, the reminder should be not rely heavily on GetHashCode.

]]></description>
			<content:encoded><![CDATA[	<p>Some time ago <a href="http://temujin.blogsome.com/2008/05/09/the-perils-of-gethashcode/">I wrote about <b>GetHashCode</b> method</a> and now <a href="http://msmvps.com/blogs/paulomorgado/about.aspx">Paulo Morgado</a> has also faced <a href="http://msmvps.com/blogs/paulomorgado/archive/2008/05/30/getting-net-1-1-clr-string-hash-codes-in-the-net-2-0-clr.aspx">some &#8220;<i>hash</i> related&#8221; issues</a> to deal with (<a href="http://www.arquitecturadesoftware.org/blogs/paulomorgado/archive/2008/05/30/obtendo-o-c-digo-hash-de-uma-string-do-clr-net-1-1-usando-o-clr-net-2-0.aspx">also in Portuguese</a>). Again, the reminder should be not rely heavily on <b><a href="http://msdn.microsoft.com/library/system.object.gethashcode.aspx">GetHashCode</a></b>.
</p>
]]></content:encoded>
			<wfw:commentRss>http://temujin.blogsome.com/2008/05/30/the-perils-of-gethashcode-continued/feed/</wfw:commentRss>
	</item>
		<item>
		<title>The Perils of GetHashCode</title>
		<link>http://temujin.blogsome.com/2008/05/09/the-perils-of-gethashcode/</link>
		<comments>http://temujin.blogsome.com/2008/05/09/the-perils-of-gethashcode/#comments</comments>
		<pubDate>Fri, 09 May 2008 10:51:59 +0000</pubDate>
		<dc:creator>João Almeida</dc:creator>
		
	<category>.net</category>
		<guid>http://temujin.blogsome.com/2008/05/09/the-perils-of-gethashcode/</guid>
		<description><![CDATA[	Recently I ran into some unexpected, and rather strange, issues on an application server using the Enterprise Library 2.0 Cache Application Block. Apparently there were occurring some strange collisions while retrieving the data from CacheData (the table where the cached data is stored) where the same cache key was having multiple entries, something the Dictionary [...]]]></description>
			<content:encoded><![CDATA[	<p>Recently I ran into some unexpected, and rather strange, issues on an application server using the Enterprise Library 2.0 Cache Application Block. Apparently there were occurring some strange collisions while retrieving the data from <span id="fxcm0"><b id="jmh50"><span id="fzdn0" class="misspell" suggestions="Cache Data,Cache-Data,Cachets,Cached,Cachet">CacheData</span></b></span> (the table where the cached data is stored) where the same <span id="h80d0" style="font-style: italic;">cache key</span> was having multiple entries, something the <span id="xk8g0" style="font-weight: bold;">Dictionary</span> container where the data is stored isn&#8217;t too happy about. The guys at <a title="Patterns and Practices" target="_blank" href="http://www.google.pt/url?sa=t&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Fpractices%2Fdefault.aspx&amp;ei=byYkSIfJFIfO0QSOhI3GCw&amp;usg=AFQjCNFNP9axP4bF9ejllI0adDkHIu3g7A&amp;sig2=mPStKX5mp12XjrPkG0QyyQ" id="ikzt">Patterns and Practices</a>, for performance issues, don&#8217;t use the <span id="iaad0" style="font-style: italic;">cache key</span> as a primary key for that table, but a much more efficient and more easily <a title="indexable" target="_blank" href="http://msdn.microsoft.com/en-us/library/ms191195.aspx" id="e6x3">&#8220;<span id="fzdn1" class="misspell" suggestions="index able,index-able,ineducable,indictable,inducible">indexable</span></a>&#8221; integer, which, in this case, is being calculated using the <span id="ja6v0" style="font-weight: bold;"></span><span id="fzdn2" class="misspell" suggestions="">GetHashCode</span> of the <span id="ja6v1" style="font-style: italic;">cache key</span>. Usually the <span id="hgte0" style="font-weight: bold;"></span><span id="fzdn3" class="misspell" suggestions="">GetHashCode</span>implementation isn&#8217;t a fully blown hash algorithm (unlike the more robust <a title="MD5" href="http://en.wikipedia.org/wiki/MD5" id="ps8w">MD5</a> or <a title="SHA" href="http://en.wikipedia.org/wiki/SHA" id="xkfp"><span id="fzdn4" class="misspell" suggestions="SHAE,SHAW,SHAY,SHEA,SHAH">SHA</span></a>) so I <span id="fzdn5" class="misspell" suggestions="all ways,all-ways,always,alleyways,allays">allways</span> doubted of the uniqueness, particularly in this case where the application server was moved from a 32 bit to a 64 bit architecture, nothing a quick trip do the <a title="String.GetHashCode()" target="_blank" href="http://msdn.microsoft.com/en-us/library/system.string.gethashcode.aspx" id="xf76">good old <span id="fzdn6" class="misspell" suggestions="MASON,MEDAN,MESON,MISDO,MST">MSDN</span></a> wouldn&#8217;t confirm:<br id="h8:o0"/></p>
	<blockquote id="i_4t0"><p><span id="kpx30"><b id="jmh51">Remarks</b></span><br id="kpx31"/><br />
The behavior of <b id="jy3n0"><span id="fzdn7" class="misspell" suggestions="">GetHashCode</span></b> is dependent on its implementation, which might change from one version of the common language <span id="fzdn8" class="misspell" suggestions="run time,run-time,runtier,reunite,centime">runtime</span> to another. A reason why this might happen is to improve the performance of <b id="jy3n1"><span id="fzdn9" class="misspell" suggestions="">GetHashCode</span></b>. </p></blockquote>
	<p id="j0w90">This basically means you shouldn&#8217;t trust <span id="i_4t1"><b id="agzt0"><span id="fzdn10" class="misspell" suggestions="">GetHashCode</span></b>, because the result for a given string can, and surely will, be different depending where you are calculating it</span>, namely between 32 and 64 bit architectures. The main lesson to be learnt here is <span id="i_4t1"><b id="jiz60"><span id="fzdn11" class="misspell" suggestions="">GetHashCode</span></b></span>, either for <i id="xgwj0">String</i> or any other type, should only be used for&nbsp;<span id="yuwc0" class="hw">disambiguation</span> of entities in <span id="xgwj1"><i id="jiz61"><span id="fzdn12" class="misspell" suggestions="run time,run-time,runtier,reunite,centime">runtime</span></i></span>.<br id="i_4t2"/>
</p>
]]></content:encoded>
			<wfw:commentRss>http://temujin.blogsome.com/2008/05/09/the-perils-of-gethashcode/feed/</wfw:commentRss>
	</item>
		<item>
		<title>Scrum with Portuguese flavour</title>
		<link>http://temujin.blogsome.com/2008/02/12/scrum-with-portuguese-flavour/</link>
		<comments>http://temujin.blogsome.com/2008/02/12/scrum-with-portuguese-flavour/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 19:28:58 +0000</pubDate>
		<dc:creator>João Almeida</dc:creator>
		
	<category>agile</category>
	<category>scrum</category>
		<guid>http://temujin.blogsome.com/2008/02/12/scrum-with-portuguese-flavour/</guid>
		<description><![CDATA[	All those Portuguese speaking interested in Scrum followers now have a place to share thoughts, experiences and everything else Scrum related, yet in a very early stage.
	Scrum em Português

]]></description>
			<content:encoded><![CDATA[	<p>All those Portuguese speaking interested in <a href="en.wikipedia.org/wiki/Scrum_%28development%29%20">Scrum</a> followers now have a place to share thoughts, experiences and everything else Scrum related, yet in a very early stage.</p>
	<p><a href="http://scrumpt.com/"><b>Scrum em Português</b></a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://temujin.blogsome.com/2008/02/12/scrum-with-portuguese-flavour/feed/</wfw:commentRss>
	</item>
	</channel>
</rss>
