<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>t+1 - Latest Comments in The gauntlet software pattern</title><link>http://tplus1.disqus.com/</link><description></description><atom:link href="http://tplus1.disqus.com/the_gauntlet_software_pattern/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 08 Nov 2011 17:05:52 -0000</lastBuildDate><item><title>Re: The gauntlet software pattern</title><link>http://blog.tplus1.com/index.php/2011/02/27/the-gauntlet-software-pattern/#comment-358722278</link><description>&lt;p&gt;Hey, thanks for the comment!&lt;/p&gt;

&lt;p&gt;Stuff like this is largely a matter of taste rather than hard science. Your way is more readable to you, but for me, the multiple returns are a signal to me that I can immediately stop reading.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Tue, 08 Nov 2011 17:05:52 -0000</pubDate></item><item><title>Re: The gauntlet software pattern</title><link>http://blog.tplus1.com/index.php/2011/02/27/the-gauntlet-software-pattern/#comment-358713447</link><description>&lt;p&gt;I think an if else statement is just as efficient / readable and you can still end up with a single return statement.&lt;/p&gt;

&lt;p&gt;bool rValue = true;&lt;/p&gt;

&lt;p&gt;if( not a ){&lt;br&gt;  rValue = false;&lt;br&gt;}else if (not b){ &lt;br&gt;  rValue = false;&lt;br&gt;}&lt;/p&gt;

&lt;p&gt;return rValue;&lt;/p&gt;

&lt;p&gt;multiple return statements turn into a nightmare when using loops.  My preference is to use a single return statement.  I have seen too many times where multiple statements turn ugly, and haven't yet see a use case where sticking to a single return is mutually exclusive from good code.  these are just my thoughts however.  they may be wrong.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">MattO</dc:creator><pubDate>Tue, 08 Nov 2011 16:55:25 -0000</pubDate></item><item><title>Re: The gauntlet software pattern</title><link>http://blog.tplus1.com/index.php/2011/02/27/the-gauntlet-software-pattern/#comment-313432991</link><description>&lt;p&gt;Error in code above -- what if (a &amp;amp;&amp;amp; b &amp;amp;&amp;amp; c &amp;amp;&amp;amp; !(d || e) &amp;amp;&amp;amp; !(f &amp;amp;&amp;amp; g))&lt;br&gt;in the original code, nothing is returned, in both subsequent examples, different values are returned.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dave</dc:creator><pubDate>Fri, 16 Sep 2011 16:51:41 -0000</pubDate></item><item><title>Re: The gauntlet software pattern</title><link>http://blog.tplus1.com/index.php/2011/02/27/the-gauntlet-software-pattern/#comment-174892372</link><description>&lt;p&gt;Przemyslaw -- thanks for the links!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Wed, 30 Mar 2011 10:50:09 -0000</pubDate></item><item><title>Re: The gauntlet software pattern</title><link>http://blog.tplus1.com/index.php/2011/02/27/the-gauntlet-software-pattern/#comment-174867415</link><description>&lt;p&gt;Folks, that pattern already has its name: it's "guard clause". See &lt;a href="http://c2.com/cgi/wiki?GuardClause" rel="nofollow"&gt;http://c2.com/cgi/wiki?GuardCl...&lt;/a&gt; or &lt;a href="http://www.refactoring.com/catalog/replaceNestedConditionalWithGuardClauses.html" rel="nofollow"&gt;http://www.refactoring.com/cat...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Przemyslaw Pokrywka</dc:creator><pubDate>Wed, 30 Mar 2011 10:14:58 -0000</pubDate></item><item><title>Re: The gauntlet software pattern</title><link>http://blog.tplus1.com/index.php/2011/02/27/the-gauntlet-software-pattern/#comment-157241102</link><description>&lt;p&gt;Yup -- that's exactly what I'm going for here; that flag that says&lt;br&gt;"you're all done!".&lt;/p&gt;

&lt;p&gt;What is up with those one-return-statement guys?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Matt Wilson</dc:creator><pubDate>Sun, 27 Feb 2011 13:58:05 -0000</pubDate></item><item><title>Re: The gauntlet software pattern</title><link>http://blog.tplus1.com/index.php/2011/02/27/the-gauntlet-software-pattern/#comment-157216006</link><description>&lt;p&gt;For some reason SE-SE (Single Entry - Single Exit) code still has a strong cargo cult appeal.  I've seen people write that way even though they weren't old enough to type when the last compiler that benefited from SESE went away.&lt;/p&gt;

&lt;p&gt;I much prefer multiple return statements.  It says to the reader "you can stop reading this function now."&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jackdied</dc:creator><pubDate>Sun, 27 Feb 2011 12:36:20 -0000</pubDate></item></channel></rss>
