<?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: Minimalist Coding Style</title>
	<atom:link href="http://agilepainrelief.com/notesfromatooluser/2008/07/minimalist-coding-style.html/feed" rel="self" type="application/rss+xml" />
	<link>http://agilepainrelief.com/notesfromatooluser/2008/07/minimalist-coding-style.html</link>
	<description>Best practices for your goals</description>
	<lastBuildDate>Sat, 13 Mar 2010 23:35:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Pete Verdon</title>
		<link>http://agilepainrelief.com/notesfromatooluser/2008/07/minimalist-coding-style.html/comment-page-1#comment-158</link>
		<dc:creator>Pete Verdon</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://agilepainrelief.com/2008/07/minimalist-coding-style/#comment-158</guid>
		<description>I think I agree with more or less everything here.

An exception: I don&#039;t think there&#039;s anything wrong with using i/j/k as loop index variables. I agree that if it&#039;s a simple loop it should be a foreach, but if you need the index for some reason then i is the best possible name for it. Unless the author is particularly perverse, I know as soon as I see it that i is the loop index - it&#039;s one of the most powerful conventions going.

An observation: Objective C attempts to solve the object.doStuff(realParam, true, false) problem by naming the parameters in the call as well as the definition.
As I understand it (I don&#039;t actually program in Objective C) that call might look like [object doStuff:realparam useWidget:true bePersistant:false] . It looks a bit alien at first when you&#039;re used only to function(arguments) syntax inherited from C, but I think I could get used to it.
</description>
		<content:encoded><![CDATA[<p>I think I agree with more or less everything here.</p>
<p>An exception: I don&#8217;t think there&#8217;s anything wrong with using i/j/k as loop index variables. I agree that if it&#8217;s a simple loop it should be a foreach, but if you need the index for some reason then i is the best possible name for it. Unless the author is particularly perverse, I know as soon as I see it that i is the loop index &#8211; it&#8217;s one of the most powerful conventions going.</p>
<p>An observation: Objective C attempts to solve the object.doStuff(realParam, true, false) problem by naming the parameters in the call as well as the definition.<br />
As I understand it (I don&#8217;t actually program in Objective C) that call might look like [object doStuff:realparam useWidget:true bePersistant:false] . It looks a bit alien at first when you&#8217;re used only to function(arguments) syntax inherited from C, but I think I could get used to it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Fischer</title>
		<link>http://agilepainrelief.com/notesfromatooluser/2008/07/minimalist-coding-style.html/comment-page-1#comment-159</link>
		<dc:creator>Tim Fischer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://agilepainrelief.com/2008/07/minimalist-coding-style/#comment-159</guid>
		<description>I agree with most - have issues with foreach.  At the moment, I am dealing with serious speed issues to handle a massive ammount of rows in a table.  I Killed foreach early on due to it&#039;s speed.  Actually, in an almost direct conflict with &quot;fewer lines of code&quot;, when programming for speed, I&#039;ve found the need in many places to *add* more lines of code (unrolling loops, etc, cause quite a bit more code).

dealing with Javascript (or most interpreted languages), small variables in a loop massively speed things up as well.

Just from experience...
</description>
		<content:encoded><![CDATA[<p>I agree with most &#8211; have issues with foreach.  At the moment, I am dealing with serious speed issues to handle a massive ammount of rows in a table.  I Killed foreach early on due to it&#8217;s speed.  Actually, in an almost direct conflict with &#8220;fewer lines of code&#8221;, when programming for speed, I&#8217;ve found the need in many places to *add* more lines of code (unrolling loops, etc, cause quite a bit more code).</p>
<p>dealing with Javascript (or most interpreted languages), small variables in a loop massively speed things up as well.</p>
<p>Just from experience&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rafferty Uy</title>
		<link>http://agilepainrelief.com/notesfromatooluser/2008/07/minimalist-coding-style.html/comment-page-1#comment-160</link>
		<dc:creator>Rafferty Uy</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://agilepainrelief.com/2008/07/minimalist-coding-style/#comment-160</guid>
		<description>Great post!

May I ask why foreach is better than for loops? How is having an indexing variable a bad thing?
I believe I read somewhere that the for loop is more efficient than the foreach loop.

Rafferty
</description>
		<content:encoded><![CDATA[<p>Great post!</p>
<p>May I ask why foreach is better than for loops? How is having an indexing variable a bad thing?<br />
I believe I read somewhere that the for loop is more efficient than the foreach loop.</p>
<p>Rafferty</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Levison</title>
		<link>http://agilepainrelief.com/notesfromatooluser/2008/07/minimalist-coding-style.html/comment-page-1#comment-161</link>
		<dc:creator>Mark Levison</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://agilepainrelief.com/2008/07/minimalist-coding-style/#comment-161</guid>
		<description>Tim - I would be interested in knowing more about your experience with foreach.

Have you disassembled the foreach loop to see how its byte code differs from regular for loops? What additional instructions are there? Have you written tests that time the two variety of loops? Would you share those timings. What JVM version are you working with?

I&#039;ve never encountered a situation where the foreach loop was slower in anyway that I can measure. Hence my interest in your findings.

In addition I&#039;m certain that modern compilers and JVM&#039;s can make much better decisions about loop unrolling than I can.

Finally I assume that you&#039;re doing these optimisations in code that has already proven to be bottleneck.
</description>
		<content:encoded><![CDATA[<p>Tim &#8211; I would be interested in knowing more about your experience with foreach.</p>
<p>Have you disassembled the foreach loop to see how its byte code differs from regular for loops? What additional instructions are there? Have you written tests that time the two variety of loops? Would you share those timings. What JVM version are you working with?</p>
<p>I&#8217;ve never encountered a situation where the foreach loop was slower in anyway that I can measure. Hence my interest in your findings.</p>
<p>In addition I&#8217;m certain that modern compilers and JVM&#8217;s can make much better decisions about loop unrolling than I can.</p>
<p>Finally I assume that you&#8217;re doing these optimisations in code that has already proven to be bottleneck.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Fischer</title>
		<link>http://agilepainrelief.com/notesfromatooluser/2008/07/minimalist-coding-style.html/comment-page-1#comment-162</link>
		<dc:creator>Tim Fischer</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://agilepainrelief.com/2008/07/minimalist-coding-style/#comment-162</guid>
		<description>Mark,
Well - it&#039;s javascript that I am working in, but most interpreted languages work the same.  To be honest, I searched the net for timings on all things js before attempting to make my grid work faster.  I got massive speed increases when not using foreach and by unrolling the loops.  probably around 400% faster or better.  Other speed increases came from using arrays to joing strings instead of concatenating, etc - but when dealing with over 10,000 rows consisting of 5 or more cells each - every microsecond is seriously worth the trouble.

I wish I could give you more on the foreach other than my personal experience and &quot;best Guess&quot; - which is that in a foreach loop, each iteration has more calculations etc to do in order to &quot;figure&quot; out what it is that &quot;Each&quot; means, but if I iterate through an array of objects I am directly accessing the pointer via it&#039;s index - no calcs required.

My grid loads 3000 rows in about 17 seconds with all of the functionality of the infragistics WebGrid (which takes closer to 2 and 1/2 minutes to render).  Through the above tweaks, I gained much in the manner of speed.

For Compiled languages - I may just do the same for consistency sake though - unless I find a bottleneck! ;-)

-Tim
</description>
		<content:encoded><![CDATA[<p>Mark,<br />
Well &#8211; it&#8217;s javascript that I am working in, but most interpreted languages work the same.  To be honest, I searched the net for timings on all things js before attempting to make my grid work faster.  I got massive speed increases when not using foreach and by unrolling the loops.  probably around 400% faster or better.  Other speed increases came from using arrays to joing strings instead of concatenating, etc &#8211; but when dealing with over 10,000 rows consisting of 5 or more cells each &#8211; every microsecond is seriously worth the trouble.</p>
<p>I wish I could give you more on the foreach other than my personal experience and &#8220;best Guess&#8221; &#8211; which is that in a foreach loop, each iteration has more calculations etc to do in order to &#8220;figure&#8221; out what it is that &#8220;Each&#8221; means, but if I iterate through an array of objects I am directly accessing the pointer via it&#8217;s index &#8211; no calcs required.</p>
<p>My grid loads 3000 rows in about 17 seconds with all of the functionality of the infragistics WebGrid (which takes closer to 2 and 1/2 minutes to render).  Through the above tweaks, I gained much in the manner of speed.</p>
<p>For Compiled languages &#8211; I may just do the same for consistency sake though &#8211; unless I find a bottleneck! <img src='http://agilepainrelief.com/site/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>-Tim</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Levison</title>
		<link>http://agilepainrelief.com/notesfromatooluser/2008/07/minimalist-coding-style.html/comment-page-1#comment-163</link>
		<dc:creator>Mark Levison</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://agilepainrelief.com/2008/07/minimalist-coding-style/#comment-163</guid>
		<description>JavaScript - ahh now that&#039;s an interesting beast. I really don&#039;t know it and can&#039;t make any comment. However I wouldn&#039;t generalize lessons learned about performance from JavaScript to any other language. I&#039;m certain that foreach in Java and its .NET equivalent have been well thought out by their implementors and don&#039;t add a performance hit.
</description>
		<content:encoded><![CDATA[<p>JavaScript &#8211; ahh now that&#8217;s an interesting beast. I really don&#8217;t know it and can&#8217;t make any comment. However I wouldn&#8217;t generalize lessons learned about performance from JavaScript to any other language. I&#8217;m certain that foreach in Java and its .NET equivalent have been well thought out by their implementors and don&#8217;t add a performance hit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Binstock</title>
		<link>http://agilepainrelief.com/notesfromatooluser/2008/07/minimalist-coding-style.html/comment-page-1#comment-164</link>
		<dc:creator>Andrew Binstock</dc:creator>
		<pubDate>Tue, 30 Nov 1999 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://agilepainrelief.com/2008/07/minimalist-coding-style/#comment-164</guid>
		<description>This reminds me a lot of the rules for OO practice from Thoughtworks&#039; Jeff Bay at http://binstock.blogspot.com/2008/04/perfecting-oos-small-classes-and-short.html

</description>
		<content:encoded><![CDATA[<p>This reminds me a lot of the rules for OO practice from Thoughtworks&#8217; Jeff Bay at <a href="http://binstock.blogspot.com/2008/04/perfecting-oos-small-classes-and-short.html" rel="nofollow">http://binstock.blogspot.com/2008/04/perfecting-oos-small-classes-and-short.html</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
