<?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: Five Rules for Writing Good Code</title>
	<atom:link href="http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/</link>
	<description>photographer, entrepreneur, software engineer, musician, skier</description>
	<lastBuildDate>Wed, 01 Feb 2012 00:01:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Pranab Ghosh</title>
		<link>http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/comment-page-1/#comment-40258</link>
		<dc:creator>Pranab Ghosh</dc:creator>
		<pubDate>Fri, 05 Mar 2010 03:35:46 +0000</pubDate>
		<guid isPermaLink="false">http://skwpspace.com/2009/09/29/five-rules-for-writing-good-code/#comment-40258</guid>
		<description>When reading code  following the call chain for some use case, if you get the same feeling as when you can&#039;t wait to turn the next page of a well written book, you know it&#039;s well written software. Then reading software becomes  as much fun as writing. 

Pranab</description>
		<content:encoded><![CDATA[<p>When reading code  following the call chain for some use case, if you get the same feeling as when you can&#8217;t wait to turn the next page of a well written book, you know it&#8217;s well written software. Then reading software becomes  as much fun as writing. </p>
<p>Pranab</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luciano Cheng</title>
		<link>http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/comment-page-1/#comment-35181</link>
		<dc:creator>Luciano Cheng</dc:creator>
		<pubDate>Sun, 29 Nov 2009 21:47:28 +0000</pubDate>
		<guid isPermaLink="false">http://skwpspace.com/2009/09/29/five-rules-for-writing-good-code/#comment-35181</guid>
		<description>Yan,

Great post.

Number 5, the point about knowing the language and the framework, is a style flaw that I see constantly.  Some developers will code C like Fortran, C like C++, or Java like C++, without bothering to learn how to use a language or its framework.  This in turn makes the code a nightmare to extend or debug later on by others.

For point 3, to add to the discussion above, I always keep in mind is that there are several common situations where you cannot avoid long functions, such as with OpenGL routines or GUI initializations.  In these situations the function might be long, but perfectly acceptable if written in a self-documenting style.</description>
		<content:encoded><![CDATA[<p>Yan,</p>
<p>Great post.</p>
<p>Number 5, the point about knowing the language and the framework, is a style flaw that I see constantly.  Some developers will code C like Fortran, C like C++, or Java like C++, without bothering to learn how to use a language or its framework.  This in turn makes the code a nightmare to extend or debug later on by others.</p>
<p>For point 3, to add to the discussion above, I always keep in mind is that there are several common situations where you cannot avoid long functions, such as with OpenGL routines or GUI initializations.  In these situations the function might be long, but perfectly acceptable if written in a self-documenting style.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abhinav Upadhyay</title>
		<link>http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/comment-page-1/#comment-35171</link>
		<dc:creator>Abhinav Upadhyay</dc:creator>
		<pubDate>Sun, 29 Nov 2009 13:50:15 +0000</pubDate>
		<guid isPermaLink="false">http://skwpspace.com/2009/09/29/five-rules-for-writing-good-code/#comment-35171</guid>
		<description>Great tips!!! These are very important points and have a lot of importance in team based development. 
The explanations make a lot of sense.</description>
		<content:encoded><![CDATA[<p>Great tips!!! These are very important points and have a lot of importance in team based development.<br />
The explanations make a lot of sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Hoisie</title>
		<link>http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/comment-page-1/#comment-35165</link>
		<dc:creator>Michael Hoisie</dc:creator>
		<pubDate>Sun, 29 Nov 2009 07:08:25 +0000</pubDate>
		<guid isPermaLink="false">http://skwpspace.com/2009/09/29/five-rules-for-writing-good-code/#comment-35165</guid>
		<description>Great post. I definitely agree with the #4, your code should be idiomatic for the language you&#039;re using. I&#039;d probably suggest to seek code reviews from people who are smarter/more experienced than you.</description>
		<content:encoded><![CDATA[<p>Great post. I definitely agree with the #4, your code should be idiomatic for the language you&#8217;re using. I&#8217;d probably suggest to seek code reviews from people who are smarter/more experienced than you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yan</title>
		<link>http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/comment-page-1/#comment-35149</link>
		<dc:creator>Yan</dc:creator>
		<pubDate>Sat, 28 Nov 2009 23:58:47 +0000</pubDate>
		<guid isPermaLink="false">http://skwpspace.com/2009/09/29/five-rules-for-writing-good-code/#comment-35149</guid>
		<description>@Thor I also think it&#039;s true that 5 line methods are easier to unit test than 200 line methods. Given that you are testing your code, I would expect error rates to be reduced in 5 line methods. Of course it&#039;s possible people get lazy and don&#039;t test the 5 line methods because they assume they can understand all the implications, whereas everyone is afraid as hell of a 200 line method so they test it really thoroughly.</description>
		<content:encoded><![CDATA[<p>@Thor I also think it&#8217;s true that 5 line methods are easier to unit test than 200 line methods. Given that you are testing your code, I would expect error rates to be reduced in 5 line methods. Of course it&#8217;s possible people get lazy and don&#8217;t test the 5 line methods because they assume they can understand all the implications, whereas everyone is afraid as hell of a 200 line method so they test it really thoroughly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yan</title>
		<link>http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/comment-page-1/#comment-35148</link>
		<dc:creator>Yan</dc:creator>
		<pubDate>Sat, 28 Nov 2009 23:52:55 +0000</pubDate>
		<guid isPermaLink="false">http://skwpspace.com/2009/09/29/five-rules-for-writing-good-code/#comment-35148</guid>
		<description>@Thor that is an interesting bit of research. But my post is not about error rates, but saving people&#039;s time in maintaining your code. I think it&#039;s still true that short routines are easier to immediately grasp, especially if the method is properly named.

@landondyer to be sure, what I&#039;ve written is not gospel, and is not always true. But if I write a post that says &quot;sometimes short functions are good and sometimes long ones are good&quot; it loses all its flavor and point. You are right, nested function calls to small functions can be a pain - but I think nesting is probably a code smell in and of itself and doesn&#039;t necessarily have to do with method length, but rather how the code is organized, and how objects are interacting with each other. 

I love the &quot;tell a story&quot; concept, that is exactly what I meant when I said that the code should read like a recipe. Meaningful method names, and keeping things on the same order of abstraction within a method is what helps tell the story. Usually, if the story is told well you don&#039;t need to look inside the subchapters/sub-methods to see how they work, you can read the &#039;table of contents&#039; which is a method consisting of calls to meaningfully described methods. Conversely you can look at any submethod and understand it entirely just by its name and simplicity of its code.</description>
		<content:encoded><![CDATA[<p>@Thor that is an interesting bit of research. But my post is not about error rates, but saving people&#8217;s time in maintaining your code. I think it&#8217;s still true that short routines are easier to immediately grasp, especially if the method is properly named.</p>
<p>@landondyer to be sure, what I&#8217;ve written is not gospel, and is not always true. But if I write a post that says &#8220;sometimes short functions are good and sometimes long ones are good&#8221; it loses all its flavor and point. You are right, nested function calls to small functions can be a pain &#8211; but I think nesting is probably a code smell in and of itself and doesn&#8217;t necessarily have to do with method length, but rather how the code is organized, and how objects are interacting with each other. </p>
<p>I love the &#8220;tell a story&#8221; concept, that is exactly what I meant when I said that the code should read like a recipe. Meaningful method names, and keeping things on the same order of abstraction within a method is what helps tell the story. Usually, if the story is told well you don&#8217;t need to look inside the subchapters/sub-methods to see how they work, you can read the &#8216;table of contents&#8217; which is a method consisting of calls to meaningfully described methods. Conversely you can look at any submethod and understand it entirely just by its name and simplicity of its code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: landondyer</title>
		<link>http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/comment-page-1/#comment-35146</link>
		<dc:creator>landondyer</dc:creator>
		<pubDate>Sat, 28 Nov 2009 23:41:56 +0000</pubDate>
		<guid isPermaLink="false">http://skwpspace.com/2009/09/29/five-rules-for-writing-good-code/#comment-35146</guid>
		<description>The best programs I&#039;ve read or had to maintain &quot;tell a story.&quot;  It&#039;s a lot like reading Hemmingway; short bits of code interspersed with high-level guidance in comments.  The code is spare and lacks bells and whistles; it does what it needs to do and no more.

Using plenty of whitespace helps a lot, too.

I work on a system that does have a lot of 100 line functions.  I don&#039;t think it&#039;s that bad; while it&#039;d be nice to get on a &quot;large functions are eevvvilll&quot; warpath, I think that other qualities of code are much more important, and there are 300 line functions written by adults that are easier to read than 20 line functions written by people who just seem careless.  (The &quot;let&#039;s make functions 5 lines long&quot; school of thought makes my head spin whenever I get eight or ten method calls in).</description>
		<content:encoded><![CDATA[<p>The best programs I&#8217;ve read or had to maintain &#8220;tell a story.&#8221;  It&#8217;s a lot like reading Hemmingway; short bits of code interspersed with high-level guidance in comments.  The code is spare and lacks bells and whistles; it does what it needs to do and no more.</p>
<p>Using plenty of whitespace helps a lot, too.</p>
<p>I work on a system that does have a lot of 100 line functions.  I don&#8217;t think it&#8217;s that bad; while it&#8217;d be nice to get on a &#8220;large functions are eevvvilll&#8221; warpath, I think that other qualities of code are much more important, and there are 300 line functions written by adults that are easier to read than 20 line functions written by people who just seem careless.  (The &#8220;let&#8217;s make functions 5 lines long&#8221; school of thought makes my head spin whenever I get eight or ten method calls in).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Thor</title>
		<link>http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/comment-page-1/#comment-35143</link>
		<dc:creator>Thor</dc:creator>
		<pubDate>Sat, 28 Nov 2009 22:41:32 +0000</pubDate>
		<guid isPermaLink="false">http://skwpspace.com/2009/09/29/five-rules-for-writing-good-code/#comment-35143</guid>
		<description>In fact, in Code Complete, Steve McConnell discusses how most research shows no correlation with routine length and error rates - an in fact, at least one study showed that shorter routines are more prone to errors. A counterintuitive result for software quality authorities, no doubt.</description>
		<content:encoded><![CDATA[<p>In fact, in Code Complete, Steve McConnell discusses how most research shows no correlation with routine length and error rates &#8211; an in fact, at least one study showed that shorter routines are more prone to errors. A counterintuitive result for software quality authorities, no doubt.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yan</title>
		<link>http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/comment-page-1/#comment-32876</link>
		<dc:creator>Yan</dc:creator>
		<pubDate>Thu, 01 Oct 2009 14:34:35 +0000</pubDate>
		<guid isPermaLink="false">http://skwpspace.com/2009/09/29/five-rules-for-writing-good-code/#comment-32876</guid>
		<description>Yes, of course you are right - comments explaining Why are not a bad idea. However, almost always the right place for comments is outside of a method/class/chunk of code depending on your paradigm, explaining why the method does something. When you find them interspersed within a large method it usually means the method itself is too long. Inline documentation is not inherently bad, it&#039;s just bad when it&#039;s used as a substitute for breaking code down into small, easy to understand functions with self-descriptive names.</description>
		<content:encoded><![CDATA[<p>Yes, of course you are right &#8211; comments explaining Why are not a bad idea. However, almost always the right place for comments is outside of a method/class/chunk of code depending on your paradigm, explaining why the method does something. When you find them interspersed within a large method it usually means the method itself is too long. Inline documentation is not inherently bad, it&#8217;s just bad when it&#8217;s used as a substitute for breaking code down into small, easy to understand functions with self-descriptive names.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nathan Leach</title>
		<link>http://yanpritzker.com/2009/09/29/five-rules-for-writing-good-code/comment-page-1/#comment-32873</link>
		<dc:creator>Nathan Leach</dc:creator>
		<pubDate>Thu, 01 Oct 2009 12:52:35 +0000</pubDate>
		<guid isPermaLink="false">http://skwpspace.com/2009/09/29/five-rules-for-writing-good-code/#comment-32873</guid>
		<description>Yan,

Nice, concise list of rules. I like them all. I would add that comments can be useful in the sense that you can say &quot;why&quot; you are doing something...the &quot;how&quot; should be the clear part in the code itself. What do you think?

I do mostly corporate development, where standards dictate a certain level of inline documentation. It takes a lot of time and effort to change those rules (sigh).

Keep up the good work!</description>
		<content:encoded><![CDATA[<p>Yan,</p>
<p>Nice, concise list of rules. I like them all. I would add that comments can be useful in the sense that you can say &#8220;why&#8221; you are doing something&#8230;the &#8220;how&#8221; should be the clear part in the code itself. What do you think?</p>
<p>I do mostly corporate development, where standards dictate a certain level of inline documentation. It takes a lot of time and effort to change those rules (sigh).</p>
<p>Keep up the good work!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

