<?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>toniBlog &#187; C#</title>
	<atom:link href="http://www.the-arm.com/tag/csharp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.the-arm.com</link>
	<description>A weblog about Methodologies for Development</description>
	<lastBuildDate>Fri, 03 Sep 2010 15:05:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>AOP, NUnit and Selenium: clever screenshots of failures</title>
		<link>http://www.the-arm.com/2010/02/aop-nunit-and-selenium-clever-screenshots-of-failures/</link>
		<comments>http://www.the-arm.com/2010/02/aop-nunit-and-selenium-clever-screenshots-of-failures/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 18:48:26 +0000</pubDate>
		<dc:creator>toni</dc:creator>
				<category><![CDATA[work]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[aop]]></category>
		<category><![CDATA[c sharp]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[functional tests]]></category>
		<category><![CDATA[postsharp]]></category>
		<category><![CDATA[Selenium]]></category>

		<guid isPermaLink="false">http://www.the-arm.com/?p=495</guid>
		<description><![CDATA[Last week I did struggle finding out why a test was failing only on our Cruise box, only in the Cruise build. I wanted to get a screenshot of each failing tests, and I think I found a clever solution: aop. We already use PostSharp on our code base for logging, transaction demarcation and hibernate [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I did struggle finding out why a test was failing only on our Cruise box, only in the Cruise build.</p>
<p>I wanted to get a screenshot of each failing tests, and I think I found a clever solution: aop.</p>
<p>We already use <a href="http://www.postsharp.org/">PostSharp</a> on our code base for logging, transaction demarcation and hibernate session support, so I wrote a simple annotation for our acceptance tests:</p>
<div class="geshi no csharp">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">using</span> <span class="kw5">System</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> PostSharp.<span class="me1">Laos</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">namespace</span> Web.<span class="me1">UI</span>.<span class="me1">AcceptanceTests</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#91;</span>Serializable<span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">public</span> <span class="kw4">class</span> ScreenCaptureAttribute <span class="sy0">:</span> OnExceptionAspect</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">public</span> <span class="kw1">override</span> <span class="kw1">void</span> OnException<span class="br0">&#40;</span>MethodExecutionEventArgs eventArgs<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;SeleniumManager.<span class="me1">Selenium</span>.<span class="me1">CaptureScreenshot</span><span class="br0">&#40;</span><span class="kw4">string</span>.<span class="me1">Format</span><span class="br0">&#40;</span><span class="st0">&quot;C:<span class="es0">\\</span>{0}.jpg&quot;</span>, eventArgs.<span class="me1">Method</span>.<span class="me1">Name</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Every time a test will throw an Exception Selenium will take a screenshot of the screen: pretty simple.</p>
<p>The only caveat is that it won&#8217;t work if Cruise is running as a service, and to get a decent result you&#8217;ll probably need to maximize the web browser windows.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-arm.com/2010/02/aop-nunit-and-selenium-clever-screenshots-of-failures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fan Programming Language</title>
		<link>http://www.the-arm.com/2008/06/fan-programming-language/</link>
		<comments>http://www.the-arm.com/2008/06/fan-programming-language/#comments</comments>
		<pubDate>Tue, 17 Jun 2008 02:58:37 +0000</pubDate>
		<dc:creator>toni</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[OOD]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.java2me.org/2008/06/17/fan-programming-language/</guid>
		<description><![CDATA[I&#8217;m just having a look to Fan and it seems quite a cool language, soon more posts on this. Fan Programming Language: &#8220;Portability Write code portable to both the Java VM and the .NET CLR. Familiar Syntax Java and C# programmers will feel at home with Fan&#8217;s curly brace syntax. Concurrency Tackle concurrency with built-in [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m just having a look to Fan and it seems quite a cool language, soon more posts on this. </p>
<p><a href="http://www.fandev.org/">Fan Programming Language</a>: &#8220;Portability<br />
Write code portable to both the Java VM and the .NET CLR.</p>
<p><strong>Familiar Syntax</strong><br />
Java and C# programmers will feel at home with Fan&#8217;s curly brace syntax.
</p>
<p><strong>Concurrency</strong><br />
Tackle concurrency with built-in immutability, message passing, and REST oriented transactional memory.
</p>
<p><strong>Static and Dynamic Typing</strong><br />
Don&#8217;t like the extremes &#8211; take the middle of the road.
</p>
<p><strong>Elegant APIs</strong><br />
We&#8217;re quite obsessive about providing all the key features required for a standard library, but with much less surface area than the APIs found in Java or .NET.
</p>
<p><strong>Object Oriented</strong><br />
Everything is an object.
</p>
<p><strong>Mixins</strong><br />
Interfaces but with implementation.
</p>
<p><strong>Functional</strong><br />
Functions and closures are baked in.
</p>
<p><strong>Serialization</strong><br />
Built-in &#8216;JSON like&#8217; serialization syntax makes Fan ideal for declarative programming too.
</p>
<p><strong>REST</strong><br />
Model data with a unified namespace of resources identified with URIs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-arm.com/2008/06/fan-programming-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some (N)Hibernate Learnings</title>
		<link>http://www.the-arm.com/2008/02/some-nhibernate-learnings/</link>
		<comments>http://www.the-arm.com/2008/02/some-nhibernate-learnings/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 14:07:54 +0000</pubDate>
		<dc:creator>toni</dc:creator>
				<category><![CDATA[alt.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://blog.java2me.org/2008/02/12/some-nhibernate-learnings/</guid>
		<description><![CDATA[After at least two years of Hibernate and NHibernate experience I can say that I know what&#8217;s going on, I can&#8217;t still say that I know very well (N)Hibernate but I wanna share some learnings. The logger is your best friend: When sometimes goes wrong, the logger (or at least a profiler) will help you, [...]]]></description>
			<content:encoded><![CDATA[<p>After at least two years of Hibernate and NHibernate experience I can say that I know what&#8217;s going on, I can&#8217;t still say that I know very well (N)Hibernate but I wanna share some learnings. </p>
<ul>
<li>The logger is your best friend:<br />
When sometimes goes wrong, the logger (or at least a profiler)  will help you, it&#8217;s awesome to play with a database like we play with objects but I have the feeling that sometimes we forget that on a couple of layers below we are doing some good old SQL!
</li>
<li>(N)Hibernate is not meant for:</li>
</ul>
<ul>
<li>Bulk data manipulations:  use <a href="http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx">sqlBulkCopy</a> in (.net) or upgrade to a version &gt; 3.1.1 on Java Hibernate</li>
<li>Free developers from understanding the database: it&#8217;s nice to hide the DB structure but the DB is there, and it&#8217;s not OO!</li>
<li>Free developers from understanding (N)Hibernate. <br /> I sow many times in developers this approach: entusiasm followed by criticism followed by hate <img src='http://www.the-arm.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  It&#8217;s very easy to do simple things and terrible then to fix bugs or understand some stack traces. It&#8217;s a great library and it&#8217;s not easy to use. A copy of <a href="http://books.google.com/books?q=hibernate+in+action&amp;btnG=Search+Books">hibernate in action</a> or of <a href="http://books.google.com/books?q=nhibernate+in+action&amp;btnG=Search+Books">nhibernate in action</a> should be always present in a team playing with it.</li>
<li>Let you forget the profiler: as mentioned before it&#8217;s the best way to understand the complexity of your queries, it&#8217;s easy to end up with a cartesian product result from a query or execute unuseful queries, especially when playing with multiple joins and criteria queries.</li>
</ul>
<li>Do not generate queries using dynamic strings: queries compilations are cached (similar to query plans), it&#8217;s a nice and useful feature, especially talking about performances. Use parameters to allow reuse of query plans.</li>
<li>Lazy loading: if you don&#8217;t use lazy loading (default now) you&#8217;ll end up having all the DB in Memory, if you use lazy loading you might have the select N+1 problem&#8230;</li>
<li>Usage patterns: session per request (good for webpages, opening the session on request start, dispose on request end) Vs the session per conversation, good for rich client application. I&#8217;ve the impression that in this second case you loose a lot of the hibernate power&#8230;</li>
<li>Bags, lists, sets&#8230; : choice is yours but keep in mind that especially in a domain driven design you could have some problems having methods playing with (lazy) collections in the POJO/POCO objects. And the cost of changing from one mapping strategy to a different one can be high.</li>
<li>Optimization: you&#8217;ll have performance problems, it&#8217;s sure, you&#8217;ll have it, I don&#8217;t believe in preemptive optimization but an eye on the profiler and one on the integration tests timings could help you to find earlier problems that you&#8217;ll see otherwise when it&#8217;s too late (i.e. in production!)</li>
]]></content:encoded>
			<wfw:commentRss>http://www.the-arm.com/2008/02/some-nhibernate-learnings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do you build your projects?</title>
		<link>http://www.the-arm.com/2008/02/how-do-you-build-your-projects/</link>
		<comments>http://www.the-arm.com/2008/02/how-do-you-build-your-projects/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 11:31:48 +0000</pubDate>
		<dc:creator>toni</dc:creator>
				<category><![CDATA[agile]]></category>
		<category><![CDATA[alt.net]]></category>
		<category><![CDATA[build automation]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blog.java2me.org/2008/02/04/how-do-you-build-your-projects/</guid>
		<description><![CDATA[Recently we migrated all our build scripts from a combination of bat files + msbuild to a couple of NAnt build files. There are some reasons for this and some nice outcomes. Reasons First of all we wanted to have the same build scripts for Development, CI, QA, UAT and production Environment. On the Dev [...]]]></description>
			<content:encoded><![CDATA[<p>Recently we migrated all our build scripts from a combination of bat files + msbuild to a couple of <a href="http://nant.sourceforge.net/">NAnt</a> build files. </p>
<p>There are some reasons for this and some nice outcomes. </p>
<h2>Reasons</h2>
<p>First of all we wanted to have the same build scripts for Development, CI, QA, UAT and production Environment. </p>
<p>On the Dev machines we need to build, test and install few services (ms services, a web service and a web app).<br />
On Cruise same as above but no installation of the services and, indeed some publishing of the artifacts.<br />
The QA environment is as close as possible as the UAT/Production: it just needs installation scripts and a way to get the latest artifacts published by <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET">Cruise</a>.<br />
Using the same script gave us a great confidence when going to production: scripts were used every day by the QA, no surprises when going live.<br />
We got completely rid of all the .bat files for 2 main reasons: they become messy after 1 year of patches/fixes/modifications and we can&#8217;t really achieve the goal of one script for all as we wanted. </p>
<p>After a short investigation on alternatives to bat+msbuild (<a href="http://www.ayende.com/Blog/archive/2007/09/22/Introducing-Boobs-Boo-Build-System.aspx">boobs</a> and <a href="http://blog.jayfields.com/2005/08/using-rake-for-building-and-testing.html">rake</a>) we went for nant.<br />
We found boobs quite difficult to use and install (you need to build some libraries, install <a href="http://boo.codehaus.org/">boo</a>, etc&#8230;), in other words it does not came for free. Rake is a cool solution, we didn&#8217;t choose that cos 1) we were too lazy to install ruby everywhere (in production especially could be a problem) 2) our build, even if includes a client app, four services, a web app and a web services is fairly simple. </p>
<p>Nant is really a good translation from the Java Ant. It&#8217;s actually more than a one to one translation, it has more features and it&#8217;s somehow more powerful. </p>
<p>I really liked the <a href="http://nant.sourceforge.net/release/latest/help/functions/">functions</a> for example. And the <a href="http://nantcontrib.sourceforge.net/">contrib</a> project is plenty of nice, useful tasks ready to use.</p>
<p>Another important improvement on the build scripts was on the database scripts.<br />
Again, migrated from few bat files to one script for all the needed tasks.<br />
We had a lot of satisfaction using <a href="http://boo.codehaus.org/">dbdeploy.net</a>, it really speeds up the work, especially in the QA environment migrating the DB schema to the latest version keeping the data in. </p>
<h2>Outcomes</h2>
<p>Life easier for everybody: instead of calling a bat files with some parameters we had a file of properties (not a lot of properties, convention over configuration!) for each environment, it&#8217;s now harder to fail an installation. It&#8217;s also more clear of what&#8217;s going on thanks to the nant output log. </p>
<p>Maintenance it&#8217;s easier. There are only two files that you need to know. Tasks are pretty short and responsibilities isolated.<br />
We kept also a low lever of dependencies avoiding imports and more than two level of dependency. </p>
<p>Sometimes rewriting everything from scratch is much easier than refactoring / patching.<br />
It has been also interesting to write a build file after one year of development, usually it&#8217;s one of the first things you do in your project.</p>
<p>My suggestion is: if your build script causes problems, waste of time or if it just smells and it&#8217;s not clear what&#8217;s doing, try to spike out a different solution, the benefit could be enormous. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.the-arm.com/2008/02/how-do-you-build-your-projects/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.405 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-09-04 00:06:57 -->
