<?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: Prefer Multiline if</title>
	<atom:link href="http://cafe.elharo.com/programming/prefer-multiline-if/feed/" rel="self" type="application/rss+xml" />
	<link>http://cafe.elharo.com/programming/prefer-multiline-if/</link>
	<description>Longer than a blog; shorter than a book</description>
	<lastBuildDate>Wed, 08 Feb 2012 21:45:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
	<item>
		<title>By: Russell Bateman</title>
		<link>http://cafe.elharo.com/programming/prefer-multiline-if/comment-page-1/#comment-405897</link>
		<dc:creator>Russell Bateman</dc:creator>
		<pubDate>Fri, 05 Jun 2009 21:36:02 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/?p=367#comment-405897</guid>
		<description>A generation ago, outside the hands of a few indentured Unix old-timers, I thought the theoretical programming style community had just about laid to rest the practice of orphaning the left brace.

Arriving in Javaland, I see that this unsightly practice is alive, well and pervasive. Even old colleagues who wrote C code with aligned left and right braces (just as God does) have shriveled in the face of Eclipse&#039;s and the Java community&#039;s insistence that you modify editor behavior (which I gladly surrender myself to doing) or go digging for a preferences file (ditto).

It&#039;s a second wave of horror visited upon us a generation after Brief encouraged some of the most egregious indentation practices possible. (I, on the other hand, never abandoned vi for Brief and neither did God who must also consequently eschew Eclipse, something I&#039;m unable to do.)

Yes, I think some of you have lost your way.

Anyway, a lot, but not all of the original thesis are doctrines I&#039;ve long practiced and agree with. I also still practice, as a few others admit here, my beloved ternary expressions.</description>
		<content:encoded><![CDATA[<p>A generation ago, outside the hands of a few indentured Unix old-timers, I thought the theoretical programming style community had just about laid to rest the practice of orphaning the left brace.</p>
<p>Arriving in Javaland, I see that this unsightly practice is alive, well and pervasive. Even old colleagues who wrote C code with aligned left and right braces (just as God does) have shriveled in the face of Eclipse&#8217;s and the Java community&#8217;s insistence that you modify editor behavior (which I gladly surrender myself to doing) or go digging for a preferences file (ditto).</p>
<p>It&#8217;s a second wave of horror visited upon us a generation after Brief encouraged some of the most egregious indentation practices possible. (I, on the other hand, never abandoned vi for Brief and neither did God who must also consequently eschew Eclipse, something I&#8217;m unable to do.)</p>
<p>Yes, I think some of you have lost your way.</p>
<p>Anyway, a lot, but not all of the original thesis are doctrines I&#8217;ve long practiced and agree with. I also still practice, as a few others admit here, my beloved ternary expressions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bridget</title>
		<link>http://cafe.elharo.com/programming/prefer-multiline-if/comment-page-1/#comment-398532</link>
		<dc:creator>Bridget</dc:creator>
		<pubDate>Thu, 14 May 2009 19:59:38 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/?p=367#comment-398532</guid>
		<description>Forthesamereasonthatthisishardtoread,
whitespace makes anything (including code) more readable. It is why we put spaces between words and why short paragraphs are easier to digest.

Code isn&#039;t prose, but we humans still need to read it.</description>
		<content:encoded><![CDATA[<p>Forthesamereasonthatthisishardtoread,<br />
whitespace makes anything (including code) more readable. It is why we put spaces between words and why short paragraphs are easier to digest.</p>
<p>Code isn&#8217;t prose, but we humans still need to read it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank Berger</title>
		<link>http://cafe.elharo.com/programming/prefer-multiline-if/comment-page-1/#comment-376653</link>
		<dc:creator>Frank Berger</dc:creator>
		<pubDate>Fri, 27 Mar 2009 08:08:38 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/?p=367#comment-376653</guid>
		<description>do you really think

if (a &gt; b) {
  max = a;
}
else {
  max = b;
}

is easier to read than

max = a &lt; b ? a : b;???

1.) ?: is much less stuff to read so much easier to grasp
2.) In the verbose form I have to look at both assignments to see that they both are assignments to the same variable. 

Naturally the Math.max is the best approach here but in other cases I appreciate the ?: as concise &lt;b&gt;and&lt;/b&gt; clear.

look at this:

state = x &lt; z ? &quot;perfectly well&quot; : &quot;critical condition&quot; ;

if (x &lt; z) {
   state = &quot;perfectly well&quot;;
}
else {
   err = &quot;critical condition&quot;;
}


This only holds true with simple ?: . Nested ?:  are completely unreadable.</description>
		<content:encoded><![CDATA[<p>do you really think</p>
<p>if (a &gt; b) {<br />
  max = a;<br />
}<br />
else {<br />
  max = b;<br />
}</p>
<p>is easier to read than</p>
<p>max = a &lt; b ? a : b;???</p>
<p>1.) ?: is much less stuff to read so much easier to grasp<br />
2.) In the verbose form I have to look at both assignments to see that they both are assignments to the same variable. </p>
<p>Naturally the Math.max is the best approach here but in other cases I appreciate the ?: as concise <b>and</b> clear.</p>
<p>look at this:</p>
<p>state = x &lt; z ? &#8220;perfectly well&#8221; : &#8220;critical condition&#8221; ;</p>
<p>if (x &lt; z) {<br />
   state = &#8220;perfectly well&#8221;;<br />
}<br />
else {<br />
   err = &#8220;critical condition&#8221;;<br />
}</p>
<p>This only holds true with simple ?: . Nested ?:  are completely unreadable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pinner Blinn</title>
		<link>http://cafe.elharo.com/programming/prefer-multiline-if/comment-page-1/#comment-334795</link>
		<dc:creator>Pinner Blinn</dc:creator>
		<pubDate>Fri, 09 Jan 2009 15:31:22 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/?p=367#comment-334795</guid>
		<description>Klaus,

For precise representation of indents, emacs users should convert tabs to spaces upon saving.
That is, in the .emacs file, include something like:


(defun better-save ()
  (untabify (point-min) (point-max)))

(add-hook &#039;write-file-hooks &#039;better-save)


No shared source anywhere should include ascii tabs.</description>
		<content:encoded><![CDATA[<p>Klaus,</p>
<p>For precise representation of indents, emacs users should convert tabs to spaces upon saving.<br />
That is, in the .emacs file, include something like:</p>
<p>(defun better-save ()<br />
  (untabify (point-min) (point-max)))</p>
<p>(add-hook &#8216;write-file-hooks &#8216;better-save)</p>
<p>No shared source anywhere should include ascii tabs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Klaus</title>
		<link>http://cafe.elharo.com/programming/prefer-multiline-if/comment-page-1/#comment-333203</link>
		<dc:creator>Klaus</dc:creator>
		<pubDate>Wed, 07 Jan 2009 10:07:02 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/?p=367#comment-333203</guid>
		<description>Yeah, the Python idea is nice ... but I am always afraid enough when I
see how some C++/Java code (created with emacs) looks like in
my other editors that have no clue about the emacs-style indenting
with tabs. 

I am not sure if I want to find out what happens when a lot of people
are using different editors on the same python file. 

Spaces/tabs are easily inserted/removed from a file. I really dont like
the idea that such changes can affect the semantics of your program.</description>
		<content:encoded><![CDATA[<p>Yeah, the Python idea is nice &#8230; but I am always afraid enough when I<br />
see how some C++/Java code (created with emacs) looks like in<br />
my other editors that have no clue about the emacs-style indenting<br />
with tabs. </p>
<p>I am not sure if I want to find out what happens when a lot of people<br />
are using different editors on the same python file. </p>
<p>Spaces/tabs are easily inserted/removed from a file. I really dont like<br />
the idea that such changes can affect the semantics of your program.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: firefight</title>
		<link>http://cafe.elharo.com/programming/prefer-multiline-if/comment-page-1/#comment-332880</link>
		<dc:creator>firefight</dc:creator>
		<pubDate>Tue, 06 Jan 2009 00:44:32 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/?p=367#comment-332880</guid>
		<description>Another reason to have one statement per line is debugging: stepping through code in a debugger and reading a stack trace make so much more sense when you only have one line per code. Otherwise, where exactly was that NullPointerException thrown?</description>
		<content:encoded><![CDATA[<p>Another reason to have one statement per line is debugging: stepping through code in a debugger and reading a stack trace make so much more sense when you only have one line per code. Otherwise, where exactly was that NullPointerException thrown?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pete</title>
		<link>http://cafe.elharo.com/programming/prefer-multiline-if/comment-page-1/#comment-332236</link>
		<dc:creator>pete</dc:creator>
		<pubDate>Sun, 04 Jan 2009 12:12:34 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/?p=367#comment-332236</guid>
		<description>Here is why I like to always use braces:


if (a&lt;b) 
    System.out.println(&quot;a: &quot;+a);
    max = a;
</description>
		<content:encoded><![CDATA[<p>Here is why I like to always use braces:</p>
<p>if (a&lt;b)<br />
    System.out.println(&#8220;a: &#8220;+a);<br />
    max = a;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ned Batchelder</title>
		<link>http://cafe.elharo.com/programming/prefer-multiline-if/comment-page-1/#comment-332102</link>
		<dc:creator>Ned Batchelder</dc:creator>
		<pubDate>Sat, 03 Jan 2009 22:57:14 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/?p=367#comment-332102</guid>
		<description>The &quot;computers look at semicolons, people look at indentation&quot; idea is exactly what I tell people who chafe at Python&#039;s indentation-based blocks.  I&#039;m not sure it convinces them, but it is the best reason I know for prefering Python&#039;s way.</description>
		<content:encoded><![CDATA[<p>The &#8220;computers look at semicolons, people look at indentation&#8221; idea is exactly what I tell people who chafe at Python&#8217;s indentation-based blocks.  I&#8217;m not sure it convinces them, but it is the best reason I know for prefering Python&#8217;s way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pepito</title>
		<link>http://cafe.elharo.com/programming/prefer-multiline-if/comment-page-1/#comment-332081</link>
		<dc:creator>Pepito</dc:creator>
		<pubDate>Sat, 03 Jan 2009 21:38:16 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/?p=367#comment-332081</guid>
		<description>Well, I often learn something coming here, but today&#039;s was unexpected. I&#039;d never heard of this quite useful  tag.</description>
		<content:encoded><![CDATA[<p>Well, I often learn something coming here, but today&#8217;s was unexpected. I&#8217;d never heard of this quite useful  tag.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete Kirkham</title>
		<link>http://cafe.elharo.com/programming/prefer-multiline-if/comment-page-1/#comment-332032</link>
		<dc:creator>Pete Kirkham</dc:creator>
		<pubDate>Sat, 03 Jan 2009 18:04:46 +0000</pubDate>
		<guid isPermaLink="false">http://cafe.elharo.com/?p=367#comment-332032</guid>
		<description>Just run it through your favourite pretty printer and don&#039;t worry about it.</description>
		<content:encoded><![CDATA[<p>Just run it through your favourite pretty printer and don&#8217;t worry about it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

