<?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>Holsee&#039;s Blog &#187; .NET</title>
	<atom:link href="http://www.blog.holsee.com/category/technology/programming/net-programming-technology/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blog.holsee.com</link>
	<description>Adventures in Entrepreneurship, Code, Coffee and Photography..</description>
	<lastBuildDate>Fri, 02 Jul 2010 10:48:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>C# &amp; Objective C &#8211; Just thinking out loud&#8230;</title>
		<link>http://www.blog.holsee.com/2010/01/c-objective-c-just-me-thinking-out-loud/</link>
		<comments>http://www.blog.holsee.com/2010/01/c-objective-c-just-me-thinking-out-loud/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 15:42:17 +0000</pubDate>
		<dc:creator>holsee</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Objective C]]></category>

		<guid isPermaLink="false">http://www.blog.holsee.com/2010/01/c-objective-c-just-me-thinking-out-loud/</guid>
		<description><![CDATA[I am learning Objective C at the minute as Mac users seem to actually buy software D= and because I am hungry to learn something completely different and new.&#160; I’m coming from a Java &#38; C# background.&#160; I thought I would share some of my thoughts on the two languages. This is not a “How [...]]]></description>
			<content:encoded><![CDATA[<p>I am learning Objective C at the minute as Mac users seem to actually buy software D= and because I am hungry to learn something completely different and new.&#160; I’m coming from a Java &amp; C# background.&#160; I thought I would share some of my thoughts on the two languages. This is not a “How To” guide nor direct comparison of the two languages.&#160; I am just sharing some thoughts and perspective. I really appreciate comments and feedback no matter how critical.</p>
<p><em>This post will be complemented with a comparative implementation post where I will show the same solution to a problem in C# using Mono and Objective C using Cocoa. (*Thinks to self, I should use C# to write a Mac App with Mono and <a href="http://www.cocoa-sharp.com/" target="_blank">Cocoa#</a> if I need some UI and the Objective C solution to run on <a href="http://www.blog.holsee.com/2009/12/hello-world-in-objective-c-using-gnustep-on-windows/" target="_blank">Windows using GNUstep</a> libraries).</em></p>
<h2>C# -&#160; Extreme Growth and Evolution </h2>
<p>I do about 90% of my development with C#.&#160; I love that it is such a <a href="http://en.wikipedia.org/wiki/Swiss_Army_knife" target="_blank">Swiss Army Knife</a> of a language and that its constantly growing to become an better multipurpose tool.&#160; </p>
<p>The language first came onto the scene in 2001 with it’s 1.0 release. Now in 2010 we are scheduled to see the official release of C# 4.0 which is a completely different animal indeed.&#160; C# 1.0 was very much like Java, even with version 2.0 the same could be said, but as version 3.0 came out we started to see something very different from Java indeed. </p>
<p>Check out the Language Specs by ECMA if you care that much =] </p>
<ul>
<li><a href="http://www.ecma-international.org/publications/files/ECMA-ST-WITHDRAWN/ECMA-334,%201st%20edition,%20December%202001.pdf" target="_blank">C# 1.0</a> </li>
<li><a href="http://www.ecma-international.org/publications/files/ECMA-ST-WITHDRAWN/ECMA-334,%202nd%20edition,%20December%202002.pdf" target="_blank">C# 2.0</a> </li>
<li><a href="http://www.ecma-international.org/publications/files/ECMA-ST-WITHDRAWN/ECMA-334,%203rd%20edition,%20June%202005.pdf" target="_blank">C# 3.0</a> </li>
<li><a href="http://www.ecma-international.org/publications/standards/Ecma-334.htm" target="_blank">C# 4.0</a> </li>
</ul>
<h3>With Great Power Comes Great Responsibility</h3>
<p><strong>The flip side</strong> of a language which is gaining more and more features is inconsistent development practises in said language will become an issue.&#160; </p>
<p>C++ is famous for this.&#160; For example, if you have a relatively simple task and got 5 developers of differing experience and ability to each implement the solution with a feature rich language you will get 5 very different solutions.&#160; The junior developer will look at the experts code and it will seem like some crazy voodoo.&#160; [I hope to go into this topic in more detail in another post in the future.]</p>
<p>I would classify myself as a relatively experienced when it comes to modern C#, I am familiar with 99% of the language features and I would generally use the best tool for the job (but I am young and far from perfect it must be noted!).&#160; </p>
<p>But say I was to write a solution using the powerful functional language features such as passing delegates, composing numerous expressions using Expression Trees in a resolution based approach to the problem, or even using a multi tiered LINQ query which used the lambda syntax for delegates… I would not expect a Junior C# developer to be able to effectively <a href="http://en.wikipedia.org/wiki/Grok#In_hacker_culture" target="_blank">grok</a> and maintain such a solution without the overhead of having to learn and master these aspects of the language (and in many cases the underlying framework).</p>
<p>Of course the answer is to define coding policies (possibly enforcing them using a tool like <a href="http://msdn.microsoft.com/en-us/library/bb429476(VS.80).aspx" target="_blank">FXCop</a>), but this will enviably be broken and restrictive (as in my humble opinion this always is even if its not at the point of conception).&#160; The best or most efficient or most elegant tool (in this case language feature) for the job may be a company policy NO NO!</p>
<h2>Objective C</h2>
<p>As I learn Objective C, I see a language which..</p>
<blockquote><p>“was created … in the early 1980s”&#160; </p>
<p><a href="http://en.wikipedia.org/wiki/Objective-C">http://en.wikipedia.org/wiki/Objective-C</a></p>
</blockquote>
<p>and only reached version 2 in 2006.</p>
<blockquote><p>“At the 2006 Worldwide Developers Conference, Apple announced the forthcoming release of &quot;Objective-C 2.0,&quot; a revision of the Objective-C language to include &quot;modern garbage collection, …” <a href="http://en.wikipedia.org/wiki/Objective-C#Objective-C_2.0">http://en.wikipedia.org/wiki/Objective-C#Objective-C_2.0</a></p>
</blockquote>
<p>I also see design patterns and conventions as a first class citizen in the Objective C and Cocoa world.</p>
<p align="center"><strong>What is my point? ..consistency by being so lean.</strong></p>
<p align="left">Teams developing for the Mac &amp; iPhone are aided by this consistency.&#160; It is very likely that developers for these platforms could move to a different company and become productive on a code base very quickly and effectively as the way things are done (at a high level) will not vary a great deal.&#160; </p>
<p align="left">The <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller" target="_blank">MVC</a> pattern is an integral part of how applications are developed with Objective C, Cocoa and Interface Builder.&#160; This helps a great deal.&#160; With C#, .NET and the associated View technologies such as WPF, WinForms, WebForms, GTK etc the design pattern in place ranges from MVC, MVP, MVVM to <strong>none what so ever</strong> which is too often the case to the expense of my (and many others) mental health.&#160; This means that the consistency is not in place and design patterns (i.e. separation of concerns) are not seen as a fundamental as much as they are seen as an advanced topic and higher learning.&#160; Microsoft have released their MVC framework for web development which is called <a href="http://www.asp.net/(S(d35rmemuuono1wvm1gsp2n45))/mvc/" target="_blank">ASP.NET MVC</a>.&#160; This is a step in the correct direction, not to mention they released it under the <a href="http://www.opensource.org/licenses/ms-pl.html" target="_blank">MS-PL license</a> which allows the Mono Team to take advantage of it as part of the Mono core libraries.</p>
<p align="left">Objective C as a language is what it is, a C variant which introduces object orientation and the notion message passing to call methods on instances using a “infix” notation as opposed to “postfix” which most people are used to.</p>
<p align="left"><strong>Example: Calling a method in ObjC, C++ &amp; C#</strong></p>
<ul>
<li>
<div align="left">[obj method: parameter]; //Objective C – Infix</div>
</li>
<li>
<div align="left">obj-&gt;method(parameter); //C++ &#8211; postfix</div>
</li>
<li>obj.Method(parameter); //C# – postfix </li>
</ul>
<p align="left">As the language is low level enough, even if the solution is quite complex relative to the equivalent C# implementation there is very little that can’t be done. </p>
<p align="left">In my discussion of C# I tried to talk purely about the language, not the underlying framework be it .NET or <a href="http://www.mono-project.com/Main_Page" target="_blank">Mono</a>. With Objective C much of its power comes from the Cocoa libraries, the same can be said about C# and its frameworks I guess, but C# as a language is far more feature rich. </p>
<p align="left">I am really exited about learning Objective C, its dynamic <a href="http://en.wikipedia.org/wiki/Smalltalk" target="_blank">Small Talk</a>-esk nature intrigues me.&#160; It is lean in language features relative to C# and that I believe is its biggest advantage.</p>
<h3>Generalised Comparisons of C# &amp; Objective C</h3>
<p>C# is powerful and can be very elegant and highly productive (in the correct hands).&#160; The language features such as LINQ, lambdas, anonymous classes, expression composition, statically compiled dynamic madness, covariance &amp; contravariance… are something special, but the languages many advanced features may baffle and confuse those who are not intimate with it. </p>
<p>The development stacks which C# lives in lack structure out of the box it could be said, this can lead to some nasty un-maintainable evil without the correct guidance.&#160; When done properly C# very plays well with tooling allowing for highly accelerated development and refactoring with ease and efficiency.&#160; Objective C (which I am no expert in) seems to exist in a world of structure, best practises and conventions without taking it to the extreme as Rails does with Ruby (i.e. without a 500 page book on conventions).&#160; The language is light when it comes to features but by its nature it is by no means weak.&#160; </p>
<p>C# lives on a higher level, it is about 4 or 5 generations away from C whereas Objective C is 1 generation about C.&#160; </p>
<p>There low level control fits well with the Apple ethos.&#160; The proprietary nature of Apples hardware and the low level nature of Objective C means you can interact with the hardware components, with a large degree of control and in a consistent fashion without worrying if the hardware will work with your app.&#160; So Objective C is a better fit with the Mac in that regard. </p>
<p>In comparison C# and Java live at a higher abstraction.&#160; They are designed to work with a massive range of machines with potentially infinite hardware configurations so the fine grained control is sacrificed for portability. That is not to say you can’t call into C code from C# or Java when the need is there.</p>
<p>//Todo: This post is in need of Refactoring, but all the tests are passing =] (i.e. I think I said all I wanted to)!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.holsee.com/2010/01/c-objective-c-just-me-thinking-out-loud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generics in .NET: Value Type Closed Generic Definitions Use More Memory</title>
		<link>http://www.blog.holsee.com/2009/12/generics-in-net-value-type-closed-generic-definitions-use-more-memory/</link>
		<comments>http://www.blog.holsee.com/2009/12/generics-in-net-value-type-closed-generic-definitions-use-more-memory/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 11:50:04 +0000</pubDate>
		<dc:creator>holsee</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.blog.holsee.com/2009/12/generics-in-net-value-type-closed-generic-definitions-use-more-memory/</guid>
		<description><![CDATA[I have started to read the book &#8220;More Effective C# by Bill Wagner&#8221; one of the early points mentioned is the fact that Value types used in closed generic definitions will have a greater memory hit at runtime relative to using reference types.
This is due to the fact that when at least one value type [...]]]></description>
			<content:encoded><![CDATA[<p>I have started to read the book &#8220;More Effective C# by Bill Wagner&#8221; one of the early points mentioned is the fact that Value types used in closed generic definitions will have a greater memory hit at runtime relative to using reference types.</p>
<p>This is due to the fact that when at least one value type is used in a closed generic definition, the CLR when JIT-compiling a generic definition (either a method or a class) will create a separate &#8220;machine code page&#8221; for each value type definition e.g.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">int</span><span style="color: #008000;">&gt;</span> intList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">int</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
List<span style="color: #008000;">&lt;</span>RandomStruct<span style="color: #008000;">&gt;</span> structList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span>RandomStruct<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></pre></div></div>

<p>Generic types that will be used with multiple different reference types do not affect the memory footprint, as a shared machine code page will be used e.g.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span> stringList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
List<span style="color: #008000;">&lt;</span>RandomClass<span style="color: #008000;">&gt;</span> classList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span>RandomClass<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></pre></div></div>

<p>As the C# compiler will enforce type safety at compile time, the JIT compiler can produce a more optimized version of the machine code by assuming that the types are correct.</p>
<p>The reality is that Generics with value types provide many benefits that out weight the memory cost. These include the compile time type safety, the more concise code (no need to parse / cast).</p>
<p>When it comes to working in environments where every single little drop of memory is important such as mobile platforms, this little bit of knowledge may prove valuable, or indeed it may not, but ill leave that up to you to decide.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.holsee.com/2009/12/generics-in-net-value-type-closed-generic-definitions-use-more-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The 5 newest additions to my &#8216;dev&#8217; book shelf..</title>
		<link>http://www.blog.holsee.com/2009/12/the-5-newest-additions-to-my-dev-book-shelf/</link>
		<comments>http://www.blog.holsee.com/2009/12/the-5-newest-additions-to-my-dev-book-shelf/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 21:31:09 +0000</pubDate>
		<dc:creator>holsee</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[MacRuby]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Objective C]]></category>
		<category><![CDATA[Unit Testing]]></category>

		<guid isPermaLink="false">http://www.blog.holsee.com/2009/12/the-5-newest-additions-to-my-dev-book-shelf/</guid>
		<description><![CDATA[Just thought I would share my 5 most recent programming book purchases.
The first of which is “The Art of Unit Testing (with examples in ‘C#’ .NET)” by Roy Osherove, the only book on this list I have finished reading. This book I found to be essential reading, and I don’t say that often. I rate [...]]]></description>
			<content:encoded><![CDATA[<p>Just thought I would share my 5 most recent programming book purchases.</p>
<p>The first of which is “The Art of Unit Testing (with examples in ‘C#’ .NET)” by <a href="http://weblogs.asp.net/rosherove/" target="_blank">Roy Osherove</a>, the only book on this list I have finished reading. This book I found to be essential reading, and I don’t say that often. I rate this book so highly I recommended that it become a required text for the “Agile and Component based Development” Module at my old university.&#160; If you are looking to improve your unit testing, or if you are just starting out with unit testing this book is for you.&#160; The author purposefully avoids the topic Test Driven Development (TDD) in order to achieve clarity and focus on the actually unit testing of code without the confusion which can be caused by trying to do so whilst at the same time explaining the TDD workflow.</p>
<p><a href="http://www.amazon.co.uk/Art-Unit-Testing-Examples-NET/dp/1933988274/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1262032997&amp;sr=1-1" target="_blank"><img style="display: block; float: none; margin-left: auto; margin-right: auto" alt="" src="http://i27.tinypic.com/27xf7nn.jpg" width="242" height="309" /></a></p>
<p>C# is the love of my life.. two more books on the language from two highly regarded individuals is exactly what the doctor ordered.</p>
<p><img style="display: block; float: none; margin-left: auto; margin-right: auto" alt="" src="http://www.informit.com/ShowCover.aspx?isbn=0321580176" width="241" height="320" /></p>
<p><img style="display: block; float: none; margin-left: auto; margin-right: auto" alt="" src="http://s3.amazonaws.com/adaptiveblue_img/books/c_in_depth_what_you_need_to_master_c_2_3/jon_skeet" width="248" height="309" /></p>
<p align="center"><em>(The MEAP for the second edition (C# 4) is available </em><a href="http://www.manning.com/skeet2/" target="_blank"><em>here</em></a><em>)</em></p>
<p>2010 for me is going to be the year of C# 4, Objective C, Cocoa and Ruby.</p>
<p>When I was a Microsoft Student Partner I got it in the neck from my friends (especially the Linux Zealot housemate) about my favourite language and framework not being portable nor open source.&#160; This really pushed by button (as they well knew) considering I am passionate Open Source, Cross Platform development and learning new languages D= !</p>
<p>I am a massive fan of the <a href="http://www.mono-project.com" target="_blank">Mono Project</a>.&#160; I love the idea of C# being truly cross platform.&#160; I also like the fact that many of the .NET libraries are being ported to run on Linux and OSX.&#160; Over the last year I have been working hard to get all my apps that I write in C# to work as well on Linux (where possible).&#160; But there was one platform I did not work with.. the ever more popular OSX.</p>
<p>I find that Apple have an interesting platform (although I may not agree on principle with their ethos).&#160; But this doesn’t mean that I don’t wish to expand my skill set to be a competent developer on their platform.</p>
<p>I purchased a Macbook this Christmas, <em>against my better judgement, </em>and have purchased these two books:</p>
<p><img style="display: block; float: none; margin-left: auto; margin-right: auto" alt="" src="http://3.bp.blogspot.com/_QLwms0mVa4w/SVjmBGqQEzI/AAAAAAAAADw/OCVPn3ZyX10/s400/loc.jpg" width="234" height="308" /></p>
<p><a href="http://www.blog.holsee.com/wp-content/uploads/2009/12/0596004230.01._SCLZZZZZZZ_.jpg"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="0596004230.01._SCLZZZZZZZ_" border="0" alt="0596004230.01._SCLZZZZZZZ_" src="http://www.blog.holsee.com/wp-content/uploads/2009/12/0596004230.01._SCLZZZZZZZ__thumb.jpg" width="181" height="306" /></a></p>
<p>Why learn Objective C when I could just use C# with Mono?</p>
<p>Because I, as a hacker at heart, am not satisfied with some abstraction over what is going on… I want to be a strong Objective C developer with a sound knowledge of Cocoa and how things work in the Apple world.&#160; I find the difference from Java and .NET refreshing and I love learning stuff that is completely new.&#160; I want to be able to more effectively use and contribute back into open source projects like <a href="http://www.mono-project.com/CocoaSharp" target="_blank">CocoaSharp</a> and <a href="http://www.macruby.org/" target="_blank">MacRuby</a> / <a href="http://www.macruby.org/trac/wiki/HotCocoa" target="_blank">HotCocoa</a>.</p>
<p>I like how its low level and not “as easy”… I have recently graduated and I am still hungry so lets hope this new educational expedition lives up to my expectations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.holsee.com/2009/12/the-5-newest-additions-to-my-dev-book-shelf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>D.I. Container &#8216;Resolve Self&#8217; &#8211; The How &amp; Why not!</title>
		<link>http://www.blog.holsee.com/2009/12/d-i-container-resolve-self-the-how-why-not/</link>
		<comments>http://www.blog.holsee.com/2009/12/d-i-container-resolve-self-the-how-why-not/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 11:36:27 +0000</pubDate>
		<dc:creator>holsee</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Dependency Injection]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[PRISM]]></category>
		<category><![CDATA[Unity]]></category>

		<guid isPermaLink="false">http://www.blog.holsee.com/2009/12/d-i-container-resolve-self-the-how-why-not/</guid>
		<description><![CDATA[Recently I was wondering how PRISM (Composite Application Guidance for WPF &#38; Silverlight) achieved a magic trick with its dependency injection (DI) container.
I knew in PRISM you are free to swop in your own DI container, which is nice but I was wondering how you achieved the trick of having your container available within itself.
What [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was wondering how <a href="http://www.codeplex.com/CompositeWPF/" target="_blank">PRISM (Composite Application Guidance for WPF &amp; Silverlight)</a> achieved a magic trick with its dependency injection (DI) container.</p>
<p>I knew in PRISM you are free to swop in your own DI container, which is nice but I was wondering how you achieved the trick of having your container <strong>available within itself</strong>.</p>
<p>What do I mean?&#160; Put simple being able to resolve your DI Container in any class within your application.</p>
<p>Example: Where ‘Foo’ is just a plain old class within the application.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Foo <span style="color: #008000;">:</span> IFoo
<span style="color: #000000;">&#123;</span>
	<span style="color: #0600FF;">public</span> Bar SomeProp <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #0600FF;">public</span> Foo<span style="color: #000000;">&#40;</span>IContainer container<span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		Bar <span style="color: #008000;">=</span> container.<span style="color: #0000FF;">Resolve</span><span style="color: #008000;">&lt;</span>ibar<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>		
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>So I asked <a href="http://blogs.msdn.com/gblock" target="_blank">Glenn Block</a> (one of the main guys behind PRISM at Microsoft) on <a href="http://twitter.com/gblock" target="_blank">Twitter</a> how this was achieved and he got back to me with some great material which I thought I would share:</p>
<ul>
<li>How to resolve a DI Container in Unity from itself. </li>
<li>Why this is bad. </li>
<li>How to do it but limiting the badness. </li>
</ul>
<p>Note: Remember to read these ‘Blocks’ of tweets backwards as it is Twitter. So with 1 &amp; 3 start at the bottom and read up.</p>
<p align="center">0 &#8211; Me:</p>
<p align="center">&#160;<a href="http://www.blog.holsee.com/wp-content/uploads/2009/12/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.blog.holsee.com/wp-content/uploads/2009/12/image_thumb.png" width="429" height="84" /></a> </p>
<p align="center">1 &#8211; GBlock:</p>
<p align="center">&#160;<a href="http://www.blog.holsee.com/wp-content/uploads/2009/12/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.blog.holsee.com/wp-content/uploads/2009/12/image_thumb1.png" width="429" height="386" /></a> </p>
<p align="center">(START FROM THE BOTTOM &amp; READ UP)</p>
<p align="center">2 &#8211; Me:</p>
<p align="center">&#160;<a href="http://www.blog.holsee.com/wp-content/uploads/2009/12/image2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.blog.holsee.com/wp-content/uploads/2009/12/image_thumb2.png" width="431" height="77" /></a> </p>
<p align="center">
  <br />3 &#8211; GBlock:</p>
<p align="center">&#160;<a href="http://www.blog.holsee.com/wp-content/uploads/2009/12/image3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.blog.holsee.com/wp-content/uploads/2009/12/image_thumb3.png" width="437" height="298" /></a> </p>
<p align="center">4 &#8211; Me:</p>
<p align="center">&#160;<a href="http://www.blog.holsee.com/wp-content/uploads/2009/12/image4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.blog.holsee.com/wp-content/uploads/2009/12/image_thumb4.png" width="440" height="75" /></a></p>
<p align="left">So the recommendation is to not program against the container as “It makes parts tightly coupled to host configuration” &amp; “makes code less intentful”.</p>
<p align="left">But as with the deign of modular composition frameworks such as PRISM I found it to be a good fit and it allowed for “reasonably” rapid development of the UI and decoupling of the parts of the View &amp; ViewModel that really mattered.&#160; So I see why it was suggested, but I now also see why they now see it as an anti-pattern.</p>
<p align="left">The universal access to the Container and the Event Aggregator with Composite Events made for very easy composition of a WPF user interface from separate modules, but I would have to agree, now that I have more experience, that programming against the container at this level just felt wrong deep down, and when that is the case you know its just not meant to be.</p>
<p align="left">Please feel free to comment. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.holsee.com/2009/12/d-i-container-resolve-self-the-how-why-not/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows HPC Server 2008 Development Environment</title>
		<link>http://www.blog.holsee.com/2009/11/windows-hpc-server-2008-development-environment/</link>
		<comments>http://www.blog.holsee.com/2009/11/windows-hpc-server-2008-development-environment/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 14:46:27 +0000</pubDate>
		<dc:creator>holsee</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[HPC]]></category>
		<category><![CDATA[Windows Server 2008]]></category>

		<guid isPermaLink="false">http://www.blog.holsee.com/2009/11/windows-hpc-server-2008-development-environment/</guid>
		<description><![CDATA[Overview
I am working in the domain of distributing computing and I am looking into the Microsoft HPC Server platform as a possible option.  One of the most important aspects is the development experience, and to test that I will need to create a suitable development environment.
The environment will consist of a network of virtual machines [...]]]></description>
			<content:encoded><![CDATA[<h3>Overview</h3>
<p>I am working in the domain of distributing computing and I am looking into the Microsoft HPC Server platform as a possible option.  One of the most important aspects is the development experience, and to test that I will need to create a suitable development environment.</p>
<p>The environment will consist of a network of virtual machines with the following “Roles”:</p>
<ul>
<li>Domain Controller / DNS Host</li>
<li>HPC Server Head Node.</li>
<li>‘N’ number of Child nodes.</li>
</ul>
<p>So numerous headaches and a ServerFault Question later (<a href="http://serverfault.com/questions/87893/domain-controller-dns-issue-creating-nework-of-virtual-machines-for-developme">Domain Controller / DNS Issue &#8211; Creating Network of Virtual Machines for Development</a>), I’ve thrown together this rough guide which should hopefully aid some other poor developer get up and running developing against a Microsoft HPC Cluster.</p>
<p>BEFORE YOU CONTINUE NOTE:</p>
<ul>
<li>I am a developer, NOT an IT Professional, and my actions will reflect that.</li>
<li>This is a network of virtual machines I am using for testing purposes.</li>
<li>These are running on a SECURE LAN, working on a Private network.</li>
<li>With little to no security in place.</li>
</ul>
<p><em>So in a nutshell if you are trying to install a cluster of machines in an enterprise environment get a professional and DO NOT use this guide.</em></p>
<p><em> </em></p>
<h3>Creating the Domain Controller &amp; DNS</h3>
<p>For this I followed this great guide: <a href="http://d3planet.com/rtfb/2009/11/09/build-a-windows-server-2008-r2-domain-controller/">Build a Windows Server 2008 R2 Domain Controller</a>.</p>
<h3>Configuring machines to join Domain</h3>
<p>This is where the first real headache started.  I followed the usual steps to add a machine to the domain, but realised that the machine was point at my router (thinking it was the Domain Name Server (DNS) ).</p>
<p><strong>Step Zero: Add machine to Domain</strong></p>
<p><a href="http://www.blog.holsee.com/wp-content/uploads/2009/11/0AddToDomain.png"><span style="color: #cccccc;"> </span><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="0-AddToDomain" src="http://www.blog.holsee.com/wp-content/uploads/2009/11/0AddToDomain_thumb.png" border="0" alt="0-AddToDomain" width="510" height="385" /></a></p>
<p><strong>Error: “Domain Controller for the domain &lt;Your Domain&gt; could not be contacted”</strong></p>
<p><a href="http://www.blog.holsee.com/wp-content/uploads/2009/11/1Error.jpg"><span style="color: #cccccc;"> </span><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="1-Error" src="http://www.blog.holsee.com/wp-content/uploads/2009/11/1Error_thumb.jpg" border="0" alt="1-Error" width="507" height="380" /></a></p>
<blockquote><p><strong>Full Error Message</strong></p>
<p>Note: This information is intended for a network administrator.  If you are not your network&#8217;s administrator, notify the administrator that you received this information, which has been recorded in the file C:\Windows\debug\dcdiag.txt.<br />
The following error occurred when DNS was queried for the service location (SRV) resource record used to locate an Active Directory Domain Controller for domain 17B.CO.UK:<br />
The error was: &#8220;DNS name does not exist.&#8221;<br />
(error code 0&#215;0000232B RCODE_NAME_ERROR)<br />
The query was for the SRV record for _ldap._tcp.dc._msdcs.17B.CO.UK<br />
Common causes of this error include the following:<br />
- The DNS SRV records required to locate a AD DC for the domain are not registered in DNS. These records are registered with a DNS server automatically when a AD DC is added to a domain. They are updated by the AD DC at set intervals. This computer is configured to use DNS servers with the following IP addresses:<br />
192.168.1.1<br />
- One or more of the following zones do not include delegation to its child zone:<br />
17B.CO.UK<br />
CO.UK<br />
UK<br />
. (the root zone)<br />
For information about correcting this problem, click Help.</p></blockquote>
<p><strong>Resolution: Configure Network Card To Point at DNS Server</strong></p>
<p><strong>Go to:</strong> Network Connections &gt; ‘Properties (of your network connection) &gt; IPv4 &gt; Properties &gt; Advanced..</p>
<p><a href="http://www.blog.holsee.com/wp-content/uploads/2009/11/image8.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" src="http://www.blog.holsee.com/wp-content/uploads/2009/11/image_thumb8.png" border="0" alt="image" width="529" height="375" /></a></p>
<p><strong>Then: &gt; </strong>DNS tab &gt; Add &gt; “Enter the IP of the DNS machine (which is also you Domain Controller).</p>
<p><a href="http://www.blog.holsee.com/wp-content/uploads/2009/11/image9.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" src="http://www.blog.holsee.com/wp-content/uploads/2009/11/image_thumb9.png" border="0" alt="image" width="436" height="418" /></a></p>
<p>(Disable &amp; Enable) Your Network Connection. Now you should be able to add the machine to the domain.</p>
<p><strong>You will be prompted to Authenticate</strong></p>
<p><a href="http://www.blog.holsee.com/wp-content/uploads/2009/11/2Authenticate.png"><img style="display: block; float: none; margin-left: auto; margin-right: auto" title="2-Authenticate" src="http://www.blog.holsee.com/wp-content/uploads/2009/11/2Authenticate_thumb.png" alt="2-Authenticate" width="538" height="469" /></a></p>
<p><strong>If all is well you should see this screen</strong></p>
<p><a href="http://www.blog.holsee.com/wp-content/uploads/2009/11/3Success.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="3-Success" src="http://www.blog.holsee.com/wp-content/uploads/2009/11/3Success_thumb.png" border="0" alt="3-Success" width="543" height="473" /></a></p>
<p><strong>Finally Restart Your machine and it will have been successfully added to the Domain</strong></p>
<p><a href="http://www.blog.holsee.com/wp-content/uploads/2009/11/4Complete.png"><img style="display: block; float: none; margin-left: auto; margin-right: auto" title="4-Complete" src="http://www.blog.holsee.com/wp-content/uploads/2009/11/4Complete_thumb.png" alt="4-Complete" width="540" height="472" /></a></p>
<p><strong>Note:</strong> This step will need to be repeated for each machine you wish to add to the domain.</p>
<h3>Installing and Configuring HPC Machines</h3>
<p>For this I followed this guide  <a href="http://www.danielmoth.com/Blog/2009/10/installing-hpc-server-2008.html">Installing HPC Server 2008</a> by (Parallel Programming Guru) Daniel Moth.</p>
<h3>Conclusion</h3>
<p>That was how I got up and running developing on the HPC Platform, hope this was helpful. (Wish I had it when I started).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.holsee.com/2009/11/windows-hpc-server-2008-development-environment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Some thoughts Rx Framework &amp; Complex Event Processing</title>
		<link>http://www.blog.holsee.com/2009/11/some-thoughts-rx-framework-complex-event-processing/</link>
		<comments>http://www.blog.holsee.com/2009/11/some-thoughts-rx-framework-complex-event-processing/#comments</comments>
		<pubDate>Mon, 23 Nov 2009 11:57:33 +0000</pubDate>
		<dc:creator>holsee</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Complex Event Processing]]></category>
		<category><![CDATA[Rx Framework]]></category>

		<guid isPermaLink="false">http://www.blog.holsee.com/2009/11/some-thoughts-rx-framework-complex-event-processing/</guid>
		<description><![CDATA[Download and Get up to Speed
Get the Rx Framework libs now from here!

.NET 3.5 SP1 
.NET 4.0 
Silverlight 3.0 

Watch the PDC Session
Rx: Reactive Extensions for .NET
Want more? Watch some Channel 9
Rx Video Listing
Some Early Thoughts
This is a game changer!&#160; I can’t wait to get playing with / applying it to my daily .NET life!&#160; [...]]]></description>
			<content:encoded><![CDATA[<h3>Download and Get up to Speed</h3>
<p>Get the Rx Framework libs now from <a href="http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx" target="_blank">here</a>!</p>
<ul>
<li><a title="http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx" href="http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx"><span style="color: #cccccc">.NET 3.5 SP1</span></a> </li>
<li>.NET 4.0 </li>
<li>Silverlight 3.0 </li>
</ul>
<h4>Watch the PDC Session</h4>
<p><strong><a href="http://microsoftpdc.com/Sessions/VTL04" target="_blank">Rx: Reactive Extensions for .NET</a></strong></p>
<h4>Want more? Watch some Channel 9</h4>
<p><strong><a href="http://channel9.msdn.com/Search/?Term=Rx" target="_blank">Rx Video Listing</a></strong></p>
<h3>Some Early Thoughts</h3>
<p>This is a game changer!&#160; I can’t wait to get playing with / applying it to my daily .NET life!&#160; I’ll be blogging more on the topic when I have a better grasp of it all and something more interesting to say.</p>
<h4>Complex Event Processing</h4>
<blockquote><p><strong>“Complex event processing</strong>, or <strong>CEP</strong>, is primarily an event processing concept that deals with the task of processing multiple events with the goal of identifying the meaningful events within the event cloud.” <a href="http://en.wikipedia.org/wiki/Complex_event_processing" target="_blank">Wikipedia</a></p>
</blockquote>
<p>I really hope Rx Framework can be applied to complex event processing (CEP)..&#160; *fingers crossed*.&#160;&#160; You can see how Rx might relate to “processing multiple events” as its a push model that you can run LINQ over!</p>
<h3>Update: Microsoft’s <a href="http://msdn.microsoft.com/en-us/library/ee362541%28SQL.105%29.aspx" target="_blank">StreamInsight</a>!</h3>
<p>StreamInsight takes advantage of the Rx Framework to allow for high performance CEP.</p>
<p>This is how Microsoft describe their CEP offering:</p>
<blockquote><p>Microsoft StreamInsight is a powerful platform that you can use to develop and deploy complex event processing (CEP) applications. Its high-throughput stream processing architecture and the Microsoft .NET Framework-based development platform enable you to quickly implement robust and highly efficient event processing applications.</p>
<p>By using StreamInsight to develop CEP applications, you can achieve the following tactical and strategic goals for your business:</p>
<ul>
<li>Monitor your data from multiple sources for meaningful patterns, trends, exceptions, and opportunities.        <br />Analyze and correlate data incrementally while the data is in-flight &#8212; that is, without first storing it&#8211;yielding very low latency. Aggregate seemingly unrelated events from multiple sources and perform highly complex analyses over time.</li>
<li>Manage your business by performing low-latency analytics on the events and triggering response actions that are defined on your business key performance indicators (KPIs).        <br />Respond quickly to areas of opportunity or threat by incorporating your KPI definitions into the logic of the CEP application, thereby improving operational efficiency and your ability to respond quickly to business opportunities.</li>
<li>Mine events for new business KPIs.</li>
<li>Move toward a predictive business model by mining historical data to continuously refine and improve your KPI definitions.</li>
</ul>
</blockquote>
<p>Nice!&#160; Good times ahead on the .NET platform.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.holsee.com/2009/11/some-thoughts-rx-framework-complex-event-processing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>C# private fields to &#8216;_&#8217; or not to &#8216;_&#8217; that is the Question</title>
		<link>http://www.blog.holsee.com/2009/11/c-private-fields-to-_-or-not-to-_-that-is-the-question/</link>
		<comments>http://www.blog.holsee.com/2009/11/c-private-fields-to-_-or-not-to-_-that-is-the-question/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 17:21:16 +0000</pubDate>
		<dc:creator>holsee</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://www.blog.holsee.com/2009/11/c-private-fields-to-_-or-not-to-_-that-is-the-question/</guid>
		<description><![CDATA[I’m getting sick of the argument:
&#34;Should private fields in a class be prefixed with an ‘_’?&#34; 
So I&#8217;m going to try and crack this nut once and for all!
Example:

private double _price;	//Using “_”
&#160;
public double Price
&#123;
    get &#123; return _price; &#125;
    private set &#123; _price = value; &#125;
&#125;


private double price; 	//Not [...]]]></description>
			<content:encoded><![CDATA[<p>I’m getting sick of the argument:</p>
<p><em>&quot;Should private fields in a class be prefixed with an ‘_’?&quot; </em></p>
<p>So I&#8217;m going to try and crack this nut once and for all!</p>
<p><strong>Example:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">private</span> <span style="color: #FF0000;">double</span> _price<span style="color: #008000;">;</span>	<span style="color: #008080; font-style: italic;">//Using “_”</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">double</span> Price
<span style="color: #000000;">&#123;</span>
    get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> _price<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">private</span> set <span style="color: #000000;">&#123;</span> _price <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">private</span> <span style="color: #FF0000;">double</span> price<span style="color: #008000;">;</span> 	<span style="color: #008080; font-style: italic;">//Not using “_”</span>
&nbsp;
<span style="color: #0600FF;">public</span> <span style="color: #FF0000;">double</span> Price
<span style="color: #000000;">&#123;</span>
    get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> price<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
    <span style="color: #0600FF;">private</span> set <span style="color: #000000;">&#123;</span> price <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Note:&#160; I am well aware I could use an automatic property here, but so not the point =].</p>
<p>So what do Microsoft say? Well <a href="http://msdn.microsoft.com/en-us/library/xzf533w0%28VS.71%29.aspx" target="_blank">here</a> is their Naming Convention section of MSDN.&#160; They don’t want to touch this topic it seems as there is no guidance on how to name a private field.&#160; When they discuss property naming conventions <a href="http://msdn.microsoft.com/en-us/library/fzcth91k%28VS.71%29.aspx" target="_blank">here</a> this is all we get:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> Color
<span style="color: #000000;">&#123;</span>
	get <span style="color: #000000;">&#123;</span><span style="color: #008080; font-style: italic;">// Insert code here.}</span>
	set <span style="color: #000000;">&#123;</span><span style="color: #008080; font-style: italic;">// Insert code here.}</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Hmm that was helpful =/.</p>
<p>I got my hands on the <a href="http://www.idesign.net/idesign/DesktopDefault.aspx" target="_blank">iDesign</a> C# coding conventions which you can download from <a href="http://www.idesign.net/idesign/download/IDesign%20CSharp%20Coding%20Standard.zip" target="_blank">here</a>.</p>
<p>They go down the road of prefixing private fields with “m_”&#160; D= ! That is a barrel of worms right there so I’m going to leave it at that! </p>
<p><strong>Arguments AGAINST prefixing with an underscore:</strong></p>
<ol>
<li>In intellisense the property of said name and its backing field will appear together.<a href="http://www.blog.holsee.com/wp-content/uploads/2009/11/clip_image0018.png"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="clip_image001[8]" border="0" alt="clip_image001[8]" src="http://www.blog.holsee.com/wp-content/uploads/2009/11/clip_image0018_thumb.png" width="149" height="90" /></a> </li>
<li>C# is case sensitive therefore there seems to be no need for an ‘_’. </li>
<li>If you wish to differentiate between fields from your local variables / parameters use the “this” keyword to indicate a field from a local variable like so:

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> WithDiscount<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> price<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">price</span> <span style="color: #008000;">=</span> price<span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

</li>
<li>“StyleCop will call you a son of a whore if you use underscores” <a href="http://twitter.com/blowdart" target="_blank">@blowdart</a> </li>
</ol>
<p><em>If you can think of anymore please leave a comment.</em></p>
<p><strong>Arguments FOR prefixing private fields with an underscore:</strong></p>
<ol>
<li>When I got my C# Certification I was taught to use an &quot;_&quot;. </li>
<li>You do not need to put “this” in your code before private fields. </li>
<li>If you don’t wish to use “this” everywhere you have to get creative with naming. </li>
<li>You don’t need to think about what a variable is, “_” prefix makes it quite clear. </li>
<li>All private fields with be grouped together in intellisense:</li>
<p><a href="http://www.blog.holsee.com/wp-content/uploads/2009/11/clip_image001.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://www.blog.holsee.com/wp-content/uploads/2009/11/clip_image001_thumb.png" width="169" height="107" /></a></p>
<li>“..it allows for the same naming convention to span C# and VB.NET” <a href="http://twitter.com/csharphacker" target="_blank">@csharphacker</a></li>
<li>R# by default says so! </li>
<li>I said so &gt;.&lt;! </li>
</ol>
<p><em>Again If you can think of anymore please leave a comment.</em></p>
<p><em><strong>Conclusion</strong></em></p>
<p><em>What sells the “_” for me is the fact I don&#8217;t have to put this everywhere in my code&#160; when working with private variables nor do I have to think about alternate naming for local variables or parameters to avoid using this.</em></p>
<p><em>What is you opinion?&#160; Let the battle rage on..!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.holsee.com/2009/11/c-private-fields-to-_-or-not-to-_-that-is-the-question/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Open Source: Sourced SFTP Editor (Mono Time)</title>
		<link>http://www.blog.holsee.com/2009/10/open-source-sourced-sftp-editor-mono-time/</link>
		<comments>http://www.blog.holsee.com/2009/10/open-source-sourced-sftp-editor-mono-time/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 17:44:58 +0000</pubDate>
		<dc:creator>holsee</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Moonlight]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Sourced]]></category>

		<guid isPermaLink="false">http://www.blog.holsee.com/2009/10/open-source-sourced-sftp-editor-mono-time/</guid>
		<description><![CDATA[My housemate Stu Quin created and recently open sourced “Sourced”.
About
First release of Sourced Editor, my open source, cross platform source code editor. Sourced offers support for editing files on remote (SFTP and FTP) and local file systems.
Features:

Support for SFTP and FTP(partial)
Built in terminal for remote SFTP connections
Open projects automatically saved and restored on next use
Support [...]]]></description>
			<content:encoded><![CDATA[<p>My housemate <a href="http://www.sjdquin.com/" target="_blank">Stu Quin</a> created and recently open sourced “Sourced”.</p>
<p><strong>About</strong></p>
<blockquote><p>First release of Sourced Editor, my open source, cross platform source code editor. Sourced offers support for editing files on remote (SFTP and FTP) and local file systems.</p>
<p>Features:</p>
<ul>
<li>Support for SFTP and FTP(partial)</li>
<li>Built in terminal for remote SFTP connections</li>
<li>Open projects automatically saved and restored on next use</li>
<li>Support for public key authentication</li>
<li>Syntax highlighting and auto completion for range of languages (php, css, js, xml/html, ruby &#8230;)</li>
</ul>
<p>More about Sourced here: <a href="http://www.sjdquin.com/index.php/blog/view/sourced_editor_release" target="_blank">Stu’s Blog Post</a> on Sourced.</p></blockquote>
<p><strong>Porting to Mono</strong></p>
<p>I’ve been looking for something interesting to do with <a href="http://mono-project.com/Main_Page" target="_blank">Mono</a> and <a href="http://mono-project.com/Moonlight" target="_blank">Moonlight</a> for a while now (that is not directly related to my work) and I decided an open source project would be the way to go.  While Stu is up to his neck with his final year studies, I decided I was going to port the app to Mono in my spare time.</p>
<p><strong>Why Mono?</strong></p>
<p>I love C#.. but not only that I am going to toy with the idea of implementing the UI with Moonlight.  Mono is something I am 100% behind and <a href="http://tirania.org/blog/" target="_blank">Miguel de Icaza</a> and his Novellian army are legends, this is why.</p>
<p><strong>It’s already written in Java what is the point?</strong></p>
<p>Purely educational, experimental and to get another Mono app out there.  This port will be<strong> very much open source </strong>so it will be free for people to hack away with.</p>
<p>Time to Code!</p>
<p>Goodbye blogland!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.holsee.com/2009/10/open-source-sourced-sftp-editor-mono-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An Introduction to Fluent Interfaces &amp; Internal DSLs in C#</title>
		<link>http://www.blog.holsee.com/2009/10/fluent-interfaces-internal-domain-specific-languages/</link>
		<comments>http://www.blog.holsee.com/2009/10/fluent-interfaces-internal-domain-specific-languages/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 13:41:55 +0000</pubDate>
		<dc:creator>holsee</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[Fluent Interface]]></category>

		<guid isPermaLink="false">http://www.blog.holsee.com/2009/10/fluent-interfaces-internal-domain-specific-languages/</guid>
		<description><![CDATA[I like to learn to write code by writing software, I like to learn about writing software by writing about it.&#160; My goal is to build a series of posts which will reflect the knowledge I have gained regarding this topic of Fluent Interfaces and Internal DSLs.
Disclaimer: Authorship is not equal to Authority.&#160; I don’t [...]]]></description>
			<content:encoded><![CDATA[<p>I like to learn to write code by writing software, I like to learn about writing software by writing about it.&#160; My goal is to build a series of posts which will reflect the knowledge I have gained regarding this topic of Fluent Interfaces and Internal DSLs.</p>
<p><strong>Disclaimer</strong>: Authorship is <strong>not</strong> equal to Authority.&#160; I don’t claim to be an expert in this domain.&#160; I’m merely learning by doing so take what I write with a pinch of salt!</p>
<p><strong>Fluent Interfaces &amp; Fluent APIs</strong></p>
<p>A fluent interface to me is a the way you interact with a class in a fluent fashion.&#160; A fluent API is how you interact with a framework of classes in a fluent fashion.&#160; In all reality the terms are interchangeable with one another.</p>
<p>Over the last month I have been thinking a lot about fluent interface design in C# to create a DSL for an “Fluent” API I will be working on.&#160; I am starting to see more and more “Fluent” APIs emerging in the .NET space.</p>
<p>I am currently researching quite heavily in this area and I will be blogging about the different approaches that can be taken to develop an effective Fluent API.&#160; I want to know first hand how to create structured and compiler controlled sentences, the positives and negatives of doing so by experiencing the process of developing and developing with my own Fluent API.</p>
<p><strong>Definitions</strong></p>
<blockquote><p>“In software engineering, a <strong>fluent interface</strong> (as first coined by <a href="http://en.wikipedia.org/w/index.php?title=Eric_Evans_%28technologist%29&amp;action=edit&amp;redlink=1">Eric Evans</a> and <a href="http://en.wikipedia.org/wiki/Martin_Fowler">Martin Fowler</a>) is a way of implementing an object oriented API in a way that aims to provide for more readable code.&#160; A fluent interface is normally implemented by using method chaining to relay the instruction context of a subsequent call (but a fluent interface entails more than just method chaining).” Wikipedia: Fluent Interface</p>
</blockquote>
<blockquote><p>“Typically, method chaining simply consists of many methods on a class, each of which return the current object itself. This enables invoking another method on the same object immediately, leading to code that may look something like:” Wikipedia: Method Chaining</p>
</blockquote>
<p><strong>Simple Fluent Interface</strong></p>
<p>This is a simple example, my goal is to elaborate into more complex scenarios in later posts.</p>
<p>Here is an example of a fluent interface for creating a Coffee, it could be said we are creating a ‘internal’ DSL&#160; for creating coffee.</p>
<p>The first thing to note is that all public methods return ‘this’ in turn allowing us to chain methods together.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> CoffeeItem <span style="color: #008000;">:</span> ICoffeeItem
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">bool</span> HasMilk <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">bool</span> HasCream <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> CoffeeSize Size <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> ICoffeeBlend Blend <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> ICoffeeItem SetSizeTo<span style="color: #000000;">&#40;</span>CoffeeSize size<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        Size <span style="color: #008000;">=</span> size<span style="color: #008000;">;</span>
        <span style="color: #0600FF;">return</span> this<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> ICoffeeItem WithCream<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        HasCream <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
        <span style="color: #0600FF;">return</span> this<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> ICoffeeItem WithMilk<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        HasMilk <span style="color: #008000;">=</span> true<span style="color: #008000;">;</span>
        <span style="color: #0600FF;">return</span> this<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> ICoffeeItem SetBlendTo<span style="color: #000000;">&#40;</span>ICoffeeBlend blend<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        Blend <span style="color: #008000;">=</span> blend<span style="color: #008000;">;</span>
        <span style="color: #0600FF;">return</span> this<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>
  <br />Lets create an order and test that it works with a unit test.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span>
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> CoffeeItem_OrderAJavaSumutraWithCreamOfSizeEpic_ShouldContainSaidAttributes<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    var coffee <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> CoffeeItem<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">//Set Order</span>
    coffee.<span style="color: #0000FF;">SetBlendTo</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> JavaSumutra<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">WithCream</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">SetSizeTo</span><span style="color: #000000;">&#40;</span>CoffeeSize.<span style="color: #0000FF;">Epic</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #008080; font-style: italic;">//Assert that order was issued correctly</span>
    Assert.<span style="color: #0000FF;">That</span><span style="color: #000000;">&#40;</span>coffee.<span style="color: #0000FF;">HasCream</span>, <span style="color: #008000;">Is</span>.<span style="color: #0600FF;">True</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    Assert.<span style="color: #0000FF;">That</span><span style="color: #000000;">&#40;</span>coffee.<span style="color: #0000FF;">Blend</span>, <span style="color: #008000;">Is</span>.<span style="color: #008000;">TypeOf</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>JavaSumutra<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    Assert.<span style="color: #0000FF;">That</span><span style="color: #000000;">&#40;</span>coffee.<span style="color: #0000FF;">Size</span>, <span style="color: #008000;">Is</span>.<span style="color: #0000FF;">EqualTo</span><span style="color: #000000;">&#40;</span>CoffeeSize.<span style="color: #0000FF;">Epic</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>
  <br />I find this a nice way to write software, and it lends well to test driven development.&#160; Now lets create a Coffee Order which will contain many coffees.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> CoffeeOrder
<span style="color: #000000;">&#123;</span>
    <span style="color: #0600FF;">public</span> CoffeeOrder<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        CoffeeItems <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> List CoffeeItems <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF;">public</span> ICoffeeItem AddCoffee<span style="color: #000000;">&#40;</span>ICoffeeItem coffee<span style="color: #000000;">&#41;</span>
    <span style="color: #000000;">&#123;</span>
        CoffeeItems.<span style="color: #0000FF;">Add</span><span style="color: #000000;">&#40;</span>coffee<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF;">return</span> coffee<span style="color: #008000;">;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>
  <br />So now we can create a coffee order which contains the a coffee with its attributes being set in a a sentence.&#160; We can run this inside a unit test like so:</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #000000;">&#91;</span>Test<span style="color: #000000;">&#93;</span>
<span style="color: #0600FF;">public</span> <span style="color: #0600FF;">void</span> AddCoffee_WhenPassedACoffee_ShouldContainCoffee<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    var order <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> CoffeeOrder<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
    var coffee <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> CoffeeItem<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    order.<span style="color: #0000FF;">AddCoffee</span><span style="color: #000000;">&#40;</span>coffee<span style="color: #000000;">&#41;</span>
        .<span style="color: #0000FF;">SetBlendTo</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> JavaSumutra<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
        .<span style="color: #0000FF;">WithCream</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        .<span style="color: #0000FF;">SetSizeTo</span><span style="color: #000000;">&#40;</span>CoffeeSize.<span style="color: #0000FF;">Small</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    Assert.<span style="color: #0000FF;">That</span><span style="color: #000000;">&#40;</span>order.<span style="color: #0000FF;">CoffeeItems</span>, Has.<span style="color: #0000FF;">Member</span><span style="color: #000000;">&#40;</span>coffee<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>So that concludes the simple Coffee example.&#160; It is quite contrived but hopefully gives a quick and dirty glimpse at what a Fluent Interface is.</p>
<p>Topics I wish to cover next in the near future:</p>
<ul>
<li>Returning Interfaces to Control sentence structure within Fluent Interfaces. </li>
<li>Using Extensions Methods (C# 3.0) within Fluent Interfaces. </li>
<li>An overview of Quality Open Source Fluent APIs in .NET and what you can learn. </li>
<li>Passing in predicates and utilizing lambda expressions in Fluent&#160; Interfaces. </li>
<li>Internal versus External DSLs. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.holsee.com/2009/10/fluent-interfaces-internal-domain-specific-languages/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
