<?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/tag/net/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>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>
	</channel>
</rss>
