<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: C#: Object Initializer and The Horse Shoe</title>
	<atom:link href="http://www.markhneedham.com/blog/2009/02/16/c-object-initializer-and-the-horse-shoe/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markhneedham.com/blog/2009/02/16/c-object-initializer-and-the-horse-shoe/</link>
	<description>Thoughts on Software Development</description>
	<lastBuildDate>Sat, 11 Feb 2012 23:17:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Builders hanging off class vs Builders in same namespace at Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/02/16/c-object-initializer-and-the-horse-shoe/comment-page-1/#comment-21405</link>
		<dc:creator>Builders hanging off class vs Builders in same namespace at Mark Needham</dc:creator>
		<pubDate>Sat, 15 Aug 2009 00:56:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=947#comment-21405</guid>
		<description>[...] benefit of this approach is that it means we can make use of the object initializer to setup test data - perhaps one of the few occasions when it seems to be reasonably [...]</description>
		<content:encoded><![CDATA[<p>[...] benefit of this approach is that it means we can make use of the object initializer to setup test data &#8211; perhaps one of the few occasions when it seems to be reasonably [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: F#: Setting properties like named parameters at Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/02/16/c-object-initializer-and-the-horse-shoe/comment-page-1/#comment-19360</link>
		<dc:creator>F#: Setting properties like named parameters at Mark Needham</dc:creator>
		<pubDate>Sun, 28 Jun 2009 14:30:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=947#comment-19360</guid>
		<description>[...] C# we would typically make use of the object initializer syntax to do this, but in F# I&#039;ve been writing code like this to do the same thing: type [...]</description>
		<content:encoded><![CDATA[<p>[...] C# we would typically make use of the object initializer syntax to do this, but in F# I&#8217;ve been writing code like this to do the same thing: type [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Coding: Setters reduce trust at Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/02/16/c-object-initializer-and-the-horse-shoe/comment-page-1/#comment-17475</link>
		<dc:creator>Coding: Setters reduce trust at Mark Needham</dc:creator>
		<pubDate>Sat, 23 May 2009 06:37:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=947#comment-17475</guid>
		<description>[...] written previously about my dislike of the way the object initialiser is misused in C# 3.0 and although I&#039;ve also written about my preference for explicit modeling and the need for objects [...]</description>
		<content:encoded><![CDATA[<p>[...] written previously about my dislike of the way the object initialiser is misused in C# 3.0 and although I&#8217;ve also written about my preference for explicit modeling and the need for objects [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Coding: Good Citizens at Mark Needham</title>
		<link>http://www.markhneedham.com/blog/2009/02/16/c-object-initializer-and-the-horse-shoe/comment-page-1/#comment-11704</link>
		<dc:creator>Coding: Good Citizens at Mark Needham</dc:creator>
		<pubDate>Wed, 04 Mar 2009 14:00:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=947#comment-11704</guid>
		<description>[...] is the main reason I find the C# object initializer syntax such a nightmare - it gets blatantly abused and you end up with half constructed objects all around [...]</description>
		<content:encoded><![CDATA[<p>[...] is the main reason I find the C# object initializer syntax such a nightmare &#8211; it gets blatantly abused and you end up with half constructed objects all around [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Reflective Perspective - Chris Alcock &#187; The Morning Brew #288</title>
		<link>http://www.markhneedham.com/blog/2009/02/16/c-object-initializer-and-the-horse-shoe/comment-page-1/#comment-9530</link>
		<dc:creator>Reflective Perspective - Chris Alcock &#187; The Morning Brew #288</dc:creator>
		<pubDate>Tue, 17 Feb 2009 08:39:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=947#comment-9530</guid>
		<description>[...] C#: Object Initializer and The Horse Shoe - Mark Needham looks at object initialisers and how they can lead to messy &#8216;horse shoe&#8217; like code [...]</description>
		<content:encoded><![CDATA[<p>[...] C#: Object Initializer and The Horse Shoe &#8211; Mark Needham looks at object initialisers and how they can lead to messy &#8216;horse shoe&#8217; like code [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arjan`s World &#187; LINKBLOG for Feburary 16, 2009</title>
		<link>http://www.markhneedham.com/blog/2009/02/16/c-object-initializer-and-the-horse-shoe/comment-page-1/#comment-9447</link>
		<dc:creator>Arjan`s World &#187; LINKBLOG for Feburary 16, 2009</dc:creator>
		<pubDate>Mon, 16 Feb 2009 21:10:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=947#comment-9447</guid>
		<description>[...] C#: Object Initializer and The Horse Shoe - Mark Needham [...]</description>
		<content:encoded><![CDATA[<p>[...] C#: Object Initializer and The Horse Shoe &#8211; Mark Needham [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul</title>
		<link>http://www.markhneedham.com/blog/2009/02/16/c-object-initializer-and-the-horse-shoe/comment-page-1/#comment-9388</link>
		<dc:creator>Paul</dc:creator>
		<pubDate>Mon, 16 Feb 2009 13:20:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.markhneedham.com/blog/?p=947#comment-9388</guid>
		<description>I think this, as with so many things in software development, isn&#039;t an either/or question, it&#039;s a when.

C# gives us the tools, but it&#039;s up to us to use them wisely and appropriately. 

If a given property should always have a value, then the design of the class and its constructor(s) should be such that this is guaranteed -- null values shouldn&#039;t even be a possibility.

If a developer is coding and winds up with the horseshoe code above, then its time for him to work on his coding style -- but I&#039;d have the same issue with something like this:

new Foo(new Bar( new Baz(new Other(&quot;value&quot;,&quot;otherValue&quot;)));

In my opinion, this is no more readable than the other example, so it&#039;s not necessarily the tool, but the person using it that&#039;s the problem.

For me, the right use of this tool is in combination with constructors, not in place of.  The constructor is for required fields at a minimum and initialization is for those that aren&#039;t available in the constructor.</description>
		<content:encoded><![CDATA[<p>I think this, as with so many things in software development, isn&#8217;t an either/or question, it&#8217;s a when.</p>
<p>C# gives us the tools, but it&#8217;s up to us to use them wisely and appropriately. </p>
<p>If a given property should always have a value, then the design of the class and its constructor(s) should be such that this is guaranteed &#8212; null values shouldn&#8217;t even be a possibility.</p>
<p>If a developer is coding and winds up with the horseshoe code above, then its time for him to work on his coding style &#8212; but I&#8217;d have the same issue with something like this:</p>
<p>new Foo(new Bar( new Baz(new Other(&#8220;value&#8221;,&#8221;otherValue&#8221;)));</p>
<p>In my opinion, this is no more readable than the other example, so it&#8217;s not necessarily the tool, but the person using it that&#8217;s the problem.</p>
<p>For me, the right use of this tool is in combination with constructors, not in place of.  The constructor is for required fields at a minimum and initialization is for those that aren&#8217;t available in the constructor.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

