<?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>Emad Alashi's Blog &#187; Bunian</title>
	<atom:link href="http://www.emadashi.com/index.php/tag/bunian/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emadashi.com</link>
	<description></description>
	<lastBuildDate>Tue, 31 Aug 2010 08:00:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Beware of Static Constructors</title>
		<link>http://www.emadashi.com/index.php/2009/02/be-ware-of-static-constructors/</link>
		<comments>http://www.emadashi.com/index.php/2009/02/be-ware-of-static-constructors/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 22:39:22 +0000</pubDate>
		<dc:creator>Emad Alashi</dc:creator>
				<category><![CDATA[Bunian]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[code coverage]]></category>
		<category><![CDATA[static constructor]]></category>

		<guid isPermaLink="false">http://eashi.wordpress.com/2009/02/07/be-ware-of-static-constructors/</guid>
		<description><![CDATA[In Bunian we needed to use a static constructor for some reason, it was all going good; we tested the code and it ran smoothly&#8230;excellent (Code Coverage anyone?!).But when I came across this situation, it appeared that the static constructor wasn&#8217;t invoked!even when &#8220;Class.Method();&#8221; is called! so lets examine it.
I have two simple classes as [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.codeplex.com/bunian">Bunian</a> we needed to use a static constructor for some reason, it was all going good; we tested the code and it ran smoothly&#8230;excellent (<a href="http://en.wikipedia.org/wiki/Code_coverage">Code Coverage</a> anyone?!).<br />But when I came across this situation, it appeared that the static constructor wasn&#8217;t invoked!even when &#8220;Class.Method();&#8221; is called! so lets examine it.</p>
<p>I have two simple classes as an Example:</p>
<div style="font-size:10pt;background:#f2ebe3;color:black;font-family:courier new;">
<p style="margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">Parent</span></p>
<p style="margin:0;">{</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; <span style="color:blue;">public</span> <span style="color:blue;">static</span> <span style="color:blue;">string</span> DoSomething()</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; {</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">return</span> <span style="color:#a31515;">&#8220;Parent: DoSomething() called&#8221;</span>;</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; }</p>
<p style="margin:0;">}</p>
</div>
<p> 
<div style="font-size:10pt;background:#f2ebe3;color:black;font-family:courier new;">
<p style="margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">Child</span> : Parent</p>
<p style="margin:0;">{</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; <span style="color:blue;">static</span> Child()</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; {</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#2b91af;">Console</span>.WriteLine(<span style="color:#a31515;">&#8220;Child Static constructor called&#8221;</span>);</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; }</p>
<p style="margin:0;">&nbsp;</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; <span style="color:blue;">public</span> <span style="color:blue;">static</span> <span style="color:blue;">string</span> DoSomethingDifferent()</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; {</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">return</span> <span style="color:#a31515;">&#8220;DoSomethingDifferent() called&#8221;</span>;</p>
<p style="margin:0;">&nbsp;&nbsp;&nbsp; }</p>
<p style="margin:0;">}</p>
</div>
<p>As it may be obvious, Child inherits from Parent, Child has a static constructor that we need to be executed when ever a method is invoked by Child. Now lets check the main program executing these two lines:</p>
<div style="font-size:10pt;background:#f2ebe3;color:black;font-family:courier new;">
<p style="margin:0;"><span style="color:#2b91af;">Console</span>.WriteLine(Child.DoSomething()); <span style="color:green;">//This code will NOT invoke the static constructor</span></p>
<p style="margin:0;"><span style="color:#2b91af;">Console</span>.WriteLine(Child.DoSomethingDifferent());<span style="color:green;">//This code WILL invoke the static constructor</span></p>
</div>
<p>The surprise (at least to me) when calling &#8220;Child.DoSomething()&#8221; the static constructor isn&#8217;t invoked! because it is in the parent!! aaaaaah! bad!! that was serious for our architecture&nbsp; and we had to do lots of fixes to turns things around the right way (which I think it was for our own good for other reasons <img src='http://www.emadashi.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> )</p>
<p>This brings up the <a href="http://en.wikipedia.org/wiki/Code_coverage">Code Coverage</a> topic as well; in our case that static constructor&#8217;s job was to create an instance of a member that is only needed once, and we check on it in other times by &#8220;if _instance != null&#8221;. It always ran ok because all the test code we created used to call an original Child before calling any other method that resided in the Parent.</p>
<p>bottom line: be ware of static constructors, and check your test code&#8230;it maybe hiding &#8220;surprises&#8221; for you <img src='http://www.emadashi.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.emadashi.com/index.php/2009/02/be-ware-of-static-constructors/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Get On With It!</title>
		<link>http://www.emadashi.com/index.php/2009/01/get-on-with-it/</link>
		<comments>http://www.emadashi.com/index.php/2009/01/get-on-with-it/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 15:56:35 +0000</pubDate>
		<dc:creator>Emad Alashi</dc:creator>
				<category><![CDATA[Bunian]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[software management]]></category>
		<category><![CDATA[late]]></category>
		<category><![CDATA[procrastination]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://eashi.wordpress.com/2009/01/16/get-on-with-it/</guid>
		<description><![CDATA[When we started gathering requirements from the charity organizations for Bunian, it appeared that there are other kinds of people who benefit from the charity organization; there are &#8220;needy families&#8221; whose father is still alive but can&#8217;t sustain their families, and &#8220;students&#8221; who can&#8217;t afford their study. 
So Bunian needs to support all these Beneficiaries in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://eashi.files.wordpress.com/2009/01/clock.jpg"><img style="border-width:0;" src="http://eashi.files.wordpress.com/2009/01/clock-thumb.jpg" border="0" alt="clock" width="150" height="146" align="right" /></a>When we started gathering requirements from the charity organizations for <a href="http://www.codeplex.com/bunian">Bunian</a>, it appeared that there are other kinds of people who benefit from the charity organization; there are &#8220;needy families&#8221; whose father is still alive but can&#8217;t sustain their families, and &#8220;students&#8221; who can&#8217;t afford their study. </p>
<p>So Bunian needs to support all these Beneficiaries in smart way; we solved the problem by creating the IBeneficiary interface. But the problem is that in order to get out with the best solution ever (damn perfectionism!), we kept coming up with different solutions, and overriding them with other solutions every once in a while, and this kept going like forever!</p>
<p>Though we agreed from the beginning that we shall keep it as simple as possible and then add up to it as we get out with the first phase, yet it kept sliding &#8220;ok only we have to do this, oh and that too&#8221;. Until one day I thought I came up with the silver bullet everyone talks about <a href="http://eashi.files.wordpress.com/2009/01/4.gif"><img style="border-width:0;" src="http://eashi.files.wordpress.com/2009/01/4-thumb.gif" border="0" alt="4" width="22" height="22" /></a> , and sent an email to the group about the changes I wanted to make, when a colleague caught me online and showed her objection about the new solutions, and proposed another. Only then I woke up!! &#8220;OMG&#8230;WE ARE STILL HERE!!&#8221;<br />
Instantly, I remembered my oldest brothers comment  (Mohammad, very wise brother) about Bunian &#8220;<em>It&#8217;s great that you want to build the greatest architecture ever, but remember that Orphans are waiting!!</em>&#8221;</p>
<p>So LET&#8217;S JUST GET ON WITH IT!! ship it!! do it!! let version one come out, let &#8220;customers&#8221; benefit from it, then you take your time doing your silver bullet. So this is one of the challenges facing the Project Managers, something we developers rarely think about <img src='http://www.emadashi.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ; today&#8230;I learned my lesson!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emadashi.com/index.php/2009/01/get-on-with-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importance of Documentation</title>
		<link>http://www.emadashi.com/index.php/2008/12/importance-of-documentation/</link>
		<comments>http://www.emadashi.com/index.php/2008/12/importance-of-documentation/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 11:25:15 +0000</pubDate>
		<dc:creator>Emad Alashi</dc:creator>
				<category><![CDATA[Bunian]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[software management]]></category>
		<category><![CDATA[documentation]]></category>

		<guid isPermaLink="false">http://eashi.wordpress.com/2008/12/26/importance-of-documentation/</guid>
		<description><![CDATA[&#160;
 
Lately we have decided in Bunian to move on to NHibernate 2.0, and the contributor assigned to the move started out, only to send an email one day after: &#8220;THERE IS NO DOCUMENTATION!&#8217;.We had errors as a result to the move which couldn&#8217;t be fixed without a documentation explaining why this happened.
After searching for [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p><a href="http://eashi.files.wordpress.com/2008/12/documentation.jpg"><img style="border-width:0;" height="251" alt="documentation" src="http://eashi.files.wordpress.com/2008/12/documentation-thumb.jpg" width="174" align="right" border="0"></a> </p>
<p>Lately we have decided in <a href="http://www.codeplex.com/bunian">Bunian</a> to move on to NHibernate 2.0, and the contributor assigned to the move started out, only to send an email one day after: &#8220;THERE IS NO DOCUMENTATION!&#8217;.<br />We had errors as a result to the move which couldn&#8217;t be fixed without a documentation explaining why this happened.</p>
<p>After searching for a while, we found two resources of the new documentation:</p>
<ul>
<li>a wiki help that is hosted on <a href="http://knol.google.com/">Google Knol</a>: <br /><a title="http://knol.google.com/k/fabio-maulo/-/1nr4enxv3dpeq/21#" href="http://knol.google.com/k/fabio-maulo/-/1nr4enxv3dpeq/21#">http://knol.google.com/k/fabio-maulo/-/1nr4enxv3dpeq/21#</a><br />Not really appealing to be used extensively; no smooth flow between chapters, frames dazzle the eyes, no table of contents, but surely a great step forward for a documentation that is maintained by the community
<li>and online ordinary documentation as HTML: <br /><a title="http://www.nhforge.org/doc/nh/en/index.html" href="http://www.nhforge.org/doc/nh/en/index.html">http://www.nhforge.org/doc/nh/en/index.html</a> <br />which is my preferred way for documentation (or at least until the wiki proves its usability)</li>
</ul>
<p>Neither links were included anywhere in the NHibernate zipped file.</p>
<p>I didn&#8217;t realize how important a documentation is until it stopped us from moving on in our project; Only after we made sure that the documentation is available we decided to move on to version 2.0. The lesson to be learned is that if you are an enthusiast developer and want to add another piece of code to the world, keep in mind that your project is not only code; it is people, resources, community, ease of use, documentation, and any other simple thing that people need while you think it&#8217;s not important.</p>
<p>Of course I couldn&#8217;t find developers or contributors to open source projects greater than the NHibernate team, having such a project in the first place is awesome, and I thank each and everyone of them. I hope one day I can really contribute back to NHibernate. Thanks again guys.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emadashi.com/index.php/2008/12/importance-of-documentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
