<?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: Bracket Style and Indenting Code</title>
	<atom:link href="http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/</link>
	<description>A web designoper's journal</description>
	<lastBuildDate>Sat, 13 Mar 2010 16:05:38 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Vincent McGreevy</title>
		<link>http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/comment-page-1/#comment-5635</link>
		<dc:creator>Vincent McGreevy</dc:creator>
		<pubDate>Mon, 25 Jan 2010 16:41:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/#comment-5635</guid>
		<description>or even shorter

if (hours &lt; 24 &amp;&amp; minutes &lt; 60 &amp;&amp; seconds &lt; 60)
{
   if(hours % 2 == 0)
      return true;
   else
       return false;
}</description>
		<content:encoded><![CDATA[<p>or even shorter</p>
<p>if (hours &lt; 24 &amp;&amp; minutes &lt; 60 &amp;&amp; seconds &lt; 60)<br />
{<br />
   if(hours % 2 == 0)<br />
      return true;<br />
   else<br />
       return false;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zeph</title>
		<link>http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/comment-page-1/#comment-1453</link>
		<dc:creator>Zeph</dc:creator>
		<pubDate>Tue, 07 Jul 2009 00:54:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/#comment-1453</guid>
		<description>It&#039;s about different strokes for different folks.

I have tried a variety of styles, and gravitate back to good old K &amp; R (mostly).   I see the structure immediately via indenting, without needing to count or balance brackets - kind of like Python with closing delimiters.  Additional bracket-only lines just clutter the landscape for me (except the opening of a function definition - there it helps set that apart from control structures).  

Allman style has consistency having all braces on lines by themselves, balanced.  K&amp;R has consistency in closing braces always being at the start of a line, opening at the end, which you can treat as syntactic sugar around the control flow keywords.  Each type of pattern has its positives, which appeal to some more than others.

I disagree somewhat about formerly limited screen space as the only reason for K &amp; R - even if you have 100 lines of code visible on a rotated 24&quot; screen, there is a balance for best visual comprehension between packing code too tightly and too loosely.  For me, K&amp;R works - along with leaving empty lines where ever it makes the code easier to read.

I think it would be interesting to set up one of those eye-focus-point detectors that psychologists like to use, recording how programmers view a program - where their eyes jump as they try to absorb both the structure (forest) and the trees (individual statements and expressions).  I believe that excessive vertical displacement can be a tad slower to comprehend, similar to paragraphs which are too wide.  

Allman might make it easier to find unbalanced braces - but there are editor tools to help with that, and timewise finding unbalanced braces is a small part of program review and modification.

But your milage may vary; I don&#039;t think there&#039;s a universal best style.  I try to follow the existing style when modifying code.</description>
		<content:encoded><![CDATA[<p>It&#8217;s about different strokes for different folks.</p>
<p>I have tried a variety of styles, and gravitate back to good old K &amp; R (mostly).   I see the structure immediately via indenting, without needing to count or balance brackets &#8211; kind of like Python with closing delimiters.  Additional bracket-only lines just clutter the landscape for me (except the opening of a function definition &#8211; there it helps set that apart from control structures).  </p>
<p>Allman style has consistency having all braces on lines by themselves, balanced.  K&amp;R has consistency in closing braces always being at the start of a line, opening at the end, which you can treat as syntactic sugar around the control flow keywords.  Each type of pattern has its positives, which appeal to some more than others.</p>
<p>I disagree somewhat about formerly limited screen space as the only reason for K &amp; R &#8211; even if you have 100 lines of code visible on a rotated 24&#8243; screen, there is a balance for best visual comprehension between packing code too tightly and too loosely.  For me, K&amp;R works &#8211; along with leaving empty lines where ever it makes the code easier to read.</p>
<p>I think it would be interesting to set up one of those eye-focus-point detectors that psychologists like to use, recording how programmers view a program &#8211; where their eyes jump as they try to absorb both the structure (forest) and the trees (individual statements and expressions).  I believe that excessive vertical displacement can be a tad slower to comprehend, similar to paragraphs which are too wide.  </p>
<p>Allman might make it easier to find unbalanced braces &#8211; but there are editor tools to help with that, and timewise finding unbalanced braces is a small part of program review and modification.</p>
<p>But your milage may vary; I don&#8217;t think there&#8217;s a universal best style.  I try to follow the existing style when modifying code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny</title>
		<link>http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/comment-page-1/#comment-1452</link>
		<dc:creator>Danny</dc:creator>
		<pubDate>Sun, 05 Jul 2009 15:46:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/#comment-1452</guid>
		<description>Content inside bracers is 1 tab indented, form just stripped it for anyone wondering.</description>
		<content:encoded><![CDATA[<p>Content inside bracers is 1 tab indented, form just stripped it for anyone wondering.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny</title>
		<link>http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/comment-page-1/#comment-1451</link>
		<dc:creator>Danny</dc:creator>
		<pubDate>Sun, 05 Jul 2009 15:45:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/#comment-1451</guid>
		<description>I like:
if (hours &lt; 24 &amp;&amp; minutes &lt; 60 &amp;&amp; seconds &lt; 60)
{
    return true;
} else
{
    return false;
}
This way I have a straight uninterrupted line of opening and closing brackets I can follow without the else getting in the way. At the end of a brace just look right, if it is empty then its the end of the condition if not there is either the else of elseif. But all this is just personal preference really.</description>
		<content:encoded><![CDATA[<p>I like:<br />
if (hours &lt; 24 &amp;&amp; minutes &lt; 60 &amp;&amp; seconds &lt; 60)<br />
{<br />
    return true;<br />
} else<br />
{<br />
    return false;<br />
}<br />
This way I have a straight uninterrupted line of opening and closing brackets I can follow without the else getting in the way. At the end of a brace just look right, if it is empty then its the end of the condition if not there is either the else of elseif. But all this is just personal preference really.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EllisGL</title>
		<link>http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/comment-page-1/#comment-623</link>
		<dc:creator>EllisGL</dc:creator>
		<pubDate>Thu, 30 Oct 2008 12:56:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.catchmyfame.com/2007/12/18/bracket-style-and-indenting-code/#comment-623</guid>
		<description>I indent my code that is somewhere in between Allman and GNU styles..</description>
		<content:encoded><![CDATA[<p>I indent my code that is somewhere in between Allman and GNU styles..</p>
]]></content:encoded>
	</item>
</channel>
</rss>
