<?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: Automatic Properties (And Why You Should Avoid Them)</title>
	<atom:link href="http://charliedigital.com/2009/07/25/automatic-properties-and-why-you-should-avoid-them/feed/" rel="self" type="application/rss+xml" />
	<link>http://charliedigital.com/2009/07/25/automatic-properties-and-why-you-should-avoid-them/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=automatic-properties-and-why-you-should-avoid-them</link>
	<description>Programming, Politics, and uhh...pineapples</description>
	<lastBuildDate>Thu, 26 Aug 2010 16:17:37 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: none</title>
		<link>http://charliedigital.com/2009/07/25/automatic-properties-and-why-you-should-avoid-them/#comment-37</link>
		<dc:creator>none</dc:creator>
		<pubDate>Mon, 27 Jul 2009 08:27:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.charliedigital.com/PermaLink.aspx?guid=245d8e2f-e388-4d1f-b6a8-9b513a106e72#comment-37</guid>
		<description>I&#039;m sorry - but this is absolute rubbish.
</description>
		<content:encoded><![CDATA[<p>I&#8217;m sorry &#8211; but this is absolute rubbish.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://charliedigital.com/2009/07/25/automatic-properties-and-why-you-should-avoid-them/#comment-36</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Mon, 27 Jul 2009 00:50:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.charliedigital.com/PermaLink.aspx?guid=245d8e2f-e388-4d1f-b6a8-9b513a106e72#comment-36</guid>
		<description>Well, I&#039;m not saying I can&#039;t tell (of course I can) and my classes are rarely _huge_, but I *do* zip around my open files pretty fast.  One thing that I&#039;ve noticed is that when I do that, I&#039;m not looking at the actual text, I&#039;m looking more for the *structure* of the text in the code file.  When I see explicit getters and setters with backing fields, I know I&#039;m in a concrete class.

McConnell  has a whole section of Code Complete which discusses &quot;code shape&quot; and how it affects readability (see chapter 31).  I think this is along the same veins.  You gain *NOTHING* by using automatic properties, but you sacrifice readability and clarity.  I don&#039;t think that the argument of &quot;saving a couple lines&quot; is a valid one since you can just as easily collapse those into regions and save many more lines.

As McConnell writes:

&quot;Making the code look pretty is worth something, but it&#039;s worth less than showing the code&#039;s structure.  If one technique show the structure better and another looks better, use the one that shows the structure better.&quot;

&quot;The smaller part of the job of programming is writing a program so that the computer can read it; the larger part is writing it so that other humans can read it.&quot;

My belief is that using backing fields shows the _structure_ of the class better than using automatic properties (which was my point in the blog post).  Automatic properties are a convenience for the author, but it sacrifices structural cues to the purpose and usage of a given code file, IMO.  </description>
		<content:encoded><![CDATA[<p>Well, I&#8217;m not saying I can&#8217;t tell (of course I can) and my classes are rarely _huge_, but I *do* zip around my open files pretty fast.  One thing that I&#8217;ve noticed is that when I do that, I&#8217;m not looking at the actual text, I&#8217;m looking more for the *structure* of the text in the code file.  When I see explicit getters and setters with backing fields, I know I&#8217;m in a concrete class.</p>
<p>McConnell  has a whole section of Code Complete which discusses &quot;code shape&quot; and how it affects readability (see chapter 31).  I think this is along the same veins.  You gain *NOTHING* by using automatic properties, but you sacrifice readability and clarity.  I don&#8217;t think that the argument of &quot;saving a couple lines&quot; is a valid one since you can just as easily collapse those into regions and save many more lines.</p>
<p>As McConnell writes:</p>
<p>&quot;Making the code look pretty is worth something, but it&#8217;s worth less than showing the code&#8217;s structure.  If one technique show the structure better and another looks better, use the one that shows the structure better.&quot;</p>
<p>&quot;The smaller part of the job of programming is writing a program so that the computer can read it; the larger part is writing it so that other humans can read it.&quot;</p>
<p>My belief is that using backing fields shows the _structure_ of the class better than using automatic properties (which was my point in the blog post).  Automatic properties are a convenience for the author, but it sacrifices structural cues to the purpose and usage of a given code file, IMO.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pragmatic</title>
		<link>http://charliedigital.com/2009/07/25/automatic-properties-and-why-you-should-avoid-them/#comment-35</link>
		<dc:creator>Pragmatic</dc:creator>
		<pubDate>Sun, 26 Jul 2009 20:40:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.charliedigital.com/PermaLink.aspx?guid=245d8e2f-e388-4d1f-b6a8-9b513a106e72#comment-35</guid>
		<description>1. Automatic properties are a double edged sword. They are very useful in reducing boilerplate, however can cause some trouble at advanced edge cases. For example, I once wanted to add some validation to a property, and had to change it to a normal property. So far so good, the problem was that it meant changing the name of the backing field, therefore making the new version no longer serialization-compatible with the previous one. 

Still, I would not give up automatic properties, and another large project they have enabled me to use a design that simply wouldn&#039;t be feasible otherwise.


2. The above said, your argument in this post is just plain silly. Your main argument is that you can&#039;t tell the nature of the class\interface you&#039;re in by just looking at the syntax of an automatic property. Can&#039;t imagine why that bothers you so much, but if it does, you can just change the auto-snippet that comes with Visual Studio to add a comment at the end of each automatic property. 

It would now look like this:

string FirstName { get; set; }  /*This is an automatic property, knucklehead*/

Problem solved.

3. I&#039;m not sure how bracing style has anything to do with the topic, but I do insist on using KNF bracing, it saves me from constantly staring at 30% blank lines.

4. To people who think regular properties clutter their code, you say to hide it away with regions and not look at it. That&#039;s quite funny, coming from a guy who just posted an entire rant about how he doesn&#039;t quite like what the syntax of automatic properties looks like. Why don&#039;t YOU just surround your automatic properties with regions and not look at it?</description>
		<content:encoded><![CDATA[<p>1. Automatic properties are a double edged sword. They are very useful in reducing boilerplate, however can cause some trouble at advanced edge cases. For example, I once wanted to add some validation to a property, and had to change it to a normal property. So far so good, the problem was that it meant changing the name of the backing field, therefore making the new version no longer serialization-compatible with the previous one. </p>
<p>Still, I would not give up automatic properties, and another large project they have enabled me to use a design that simply wouldn&#8217;t be feasible otherwise.</p>
<p>2. The above said, your argument in this post is just plain silly. Your main argument is that you can&#8217;t tell the nature of the class\interface you&#8217;re in by just looking at the syntax of an automatic property. Can&#8217;t imagine why that bothers you so much, but if it does, you can just change the auto-snippet that comes with Visual Studio to add a comment at the end of each automatic property. </p>
<p>It would now look like this:</p>
<p>string FirstName { get; set; }  /*This is an automatic property, knucklehead*/</p>
<p>Problem solved.</p>
<p>3. I&#8217;m not sure how bracing style has anything to do with the topic, but I do insist on using KNF bracing, it saves me from constantly staring at 30% blank lines.</p>
<p>4. To people who think regular properties clutter their code, you say to hide it away with regions and not look at it. That&#8217;s quite funny, coming from a guy who just posted an entire rant about how he doesn&#8217;t quite like what the syntax of automatic properties looks like. Why don&#8217;t YOU just surround your automatic properties with regions and not look at it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig</title>
		<link>http://charliedigital.com/2009/07/25/automatic-properties-and-why-you-should-avoid-them/#comment-34</link>
		<dc:creator>Craig</dc:creator>
		<pubDate>Sun, 26 Jul 2009 19:37:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.charliedigital.com/PermaLink.aspx?guid=245d8e2f-e388-4d1f-b6a8-9b513a106e72#comment-34</guid>
		<description>I would hope that your classes are not so large that you get lost in them and forget where you are working.  I&#039;m sorry, but I have never had this issue, and quite frankly think it&#039;s a poor reason to dismiss a feature.

That being said, I&#039;m all ears if you can give a better reason for not using a feature other than &quot;It feels untidy&quot;.</description>
		<content:encoded><![CDATA[<p>I would hope that your classes are not so large that you get lost in them and forget where you are working.  I&#8217;m sorry, but I have never had this issue, and quite frankly think it&#8217;s a poor reason to dismiss a feature.</p>
<p>That being said, I&#8217;m all ears if you can give a better reason for not using a feature other than &quot;It feels untidy&quot;.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
