<?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: Programming When Clarity Counts</title>
	<atom:link href="http://nklein.com/2009/05/programming-when-clarity-counts/feed/" rel="self" type="application/rss+xml" />
	<link>http://nklein.com/2009/05/programming-when-clarity-counts/</link>
	<description>software development and consulting</description>
	<lastBuildDate>Fri, 30 Dec 2011 03:29:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Jim N</title>
		<link>http://nklein.com/2009/05/programming-when-clarity-counts/comment-page-1/#comment-678</link>
		<dc:creator>Jim N</dc:creator>
		<pubDate>Wed, 24 Feb 2010 03:20:30 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=285#comment-678</guid>
		<description>Here&#039;s the full Java code to set up the example (not so succinct as the example its self).

&lt;code&gt;
import java.util.ArrayList;
import java.util.List;

class Item {
	private double weight;
	Item() {};
	public double getWeight(){ return weight; }
	public Item setWeight(double weight){ this.weight = weight; return this; }
}
	
public class ItemLoop {
	
	@SuppressWarnings(&quot;unchecked&quot;)
	public static List&lt;Item&gt; makeList(double[] numbers) {
		List&lt;Item&gt; itemList = new ArrayList();
		for (double nn : numbers) {
			itemList.add(new Item().setWeight(nn));
		}
		return itemList;
	}

	public static void main(String args[]) {
		
		double[] numbers = {1.1, 2.2, 3.14159, 4.4};
		List&lt;Item&gt; itemList = ItemLoop.makeList(numbers);

		double total = 0.0;

		for (Item item : itemList) {
			total += item.getWeight();
		}
	}
}
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Here&#8217;s the full Java code to set up the example (not so succinct as the example its self).</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">import java.util.ArrayList;
import java.util.List;
&nbsp;
class Item {
	private double weight;
	Item() {};
	public double getWeight(){ return weight; }
	public Item setWeight(double weight){ this.weight = weight; return this; }
}
&nbsp;
public class ItemLoop {
&nbsp;
	@SuppressWarnings(&quot;unchecked&quot;)
	public static List&lt;Item&gt; makeList(double[] numbers) {
		List&lt;Item&gt; itemList = new ArrayList();
		for (double nn : numbers) {
			itemList.add(new Item().setWeight(nn));
		}
		return itemList;
	}
&nbsp;
	public static void main(String args[]) {
&nbsp;
		double[] numbers = {1.1, 2.2, 3.14159, 4.4};
		List&lt;Item&gt; itemList = ItemLoop.makeList(numbers);
&nbsp;
		double total = 0.0;
&nbsp;
		for (Item item : itemList) {
			total += item.getWeight();
		}
	}
}</pre></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim N</title>
		<link>http://nklein.com/2009/05/programming-when-clarity-counts/comment-page-1/#comment-677</link>
		<dc:creator>Jim N</dc:creator>
		<pubDate>Wed, 24 Feb 2010 03:14:31 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=285#comment-677</guid>
		<description>Java 1.5 does vastly improve the situation over 1.4.

&lt;code&gt;
double total = 0.0;

for (Item item : itemList) {
	total += item.getWeight();
}
&lt;/code&gt;

Last summer I was maintaining a poorly written Java 1.4 application, so I still vividly recall 1.4&#039;s awkwardness.</description>
		<content:encoded><![CDATA[<p>Java 1.5 does vastly improve the situation over 1.4.</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">double total = 0.0;
&nbsp;
for (Item item : itemList) {
	total += item.getWeight();
}</pre></div>
<p>Last summer I was maintaining a poorly written Java 1.4 application, so I still vividly recall 1.4&#8242;s awkwardness.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pat</title>
		<link>http://nklein.com/2009/05/programming-when-clarity-counts/comment-page-1/#comment-52</link>
		<dc:creator>pat</dc:creator>
		<pubDate>Sun, 17 May 2009 20:25:44 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=285#comment-52</guid>
		<description>Oh, man... Admittedly, I haven&#039;t tried building Boost for about a year and a half, but compiling Boost from source is pain.</description>
		<content:encoded><![CDATA[<p>Oh, man&#8230; Admittedly, I haven&#8217;t tried building Boost for about a year and a half, but compiling Boost from source is pain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Abram</title>
		<link>http://nklein.com/2009/05/programming-when-clarity-counts/comment-page-1/#comment-51</link>
		<dc:creator>Abram</dc:creator>
		<pubDate>Sun, 17 May 2009 19:56:06 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=285#comment-51</guid>
		<description>If, for legacy reasons, you are confined to C++, I&#039;ve found the &lt;a href=&quot;http://www.boost.org/doc/libs/1_35_0/doc/html/foreach.html&quot; rel=&quot;nofollow&quot;&gt;Boost FOREACH&lt;/a&gt; to be a nice bit of syntactic sugar:

&lt;code&gt;
double total = 0.0;
BOOST_FOREACH( itemType item, itemList) {
    total += weight( item );
}
&lt;/code&gt;

</description>
		<content:encoded><![CDATA[<p>If, for legacy reasons, you are confined to C++, I&#8217;ve found the <a href="http://www.boost.org/doc/libs/1_35_0/doc/html/foreach.html" rel="nofollow">Boost FOREACH</a> to be a nice bit of syntactic sugar:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">double total = 0.0;
BOOST_FOREACH( itemType item, itemList) {
    total += weight( item );
}</pre></div>
]]></content:encoded>
	</item>
	<item>
		<title>By: pat</title>
		<link>http://nklein.com/2009/05/programming-when-clarity-counts/comment-page-1/#comment-41</link>
		<dc:creator>pat</dc:creator>
		<pubDate>Mon, 11 May 2009 19:32:14 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=285#comment-41</guid>
		<description>I agree the map-in-void-context with side-effects is annoying.

But, coming from Perl 5, I am not jiving with much of the Perl 6 at all.  The &lt;strong&gt;[+]&lt;/strong&gt; seems to be floating in there.  (Can I use any binary function in its place?  Can I only use certain math operators?)  Map is a method or property of an array, now?  And, we&#039;ve mixed in another meaning for the colon &lt;strong&gt;:&lt;/strong&gt;?</description>
		<content:encoded><![CDATA[<p>I agree the map-in-void-context with side-effects is annoying.</p>
<p>But, coming from Perl 5, I am not jiving with much of the Perl 6 at all.  The <strong>[+]</strong> seems to be floating in there.  (Can I use any binary function in its place?  Can I only use certain math operators?)  Map is a method or property of an array, now?  And, we&#8217;ve mixed in another meaning for the colon <strong>:</strong>?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Code Clarity Revisited :: nklein software</title>
		<link>http://nklein.com/2009/05/programming-when-clarity-counts/comment-page-1/#comment-40</link>
		<dc:creator>Code Clarity Revisited :: nklein software</dc:creator>
		<pubDate>Mon, 11 May 2009 19:19:49 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=285#comment-40</guid>
		<description>[...] written in several programming languages. The loop had to sum the weights of each items in a list. Dmitry pointed out a much clearer loop in Lisp using the (loop &#8230;) construct. 1&#040;loop for item in item-list [...]</description>
		<content:encoded><![CDATA[<p>[...] written in several programming languages. The loop had to sum the weights of each items in a list. Dmitry pointed out a much clearer loop in Lisp using the (loop &#8230;) construct. 1&#40;loop for item in item-list [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chromatic</title>
		<link>http://nklein.com/2009/05/programming-when-clarity-counts/comment-page-1/#comment-39</link>
		<dc:creator>chromatic</dc:creator>
		<pubDate>Mon, 11 May 2009 19:19:30 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=285#comment-39</guid>
		<description>Aside from the syntax (which non-programmers wouldn&#039;t know), I believe it reads very well.  &quot;Total is the sum of all of the weights of every item.&quot;

The Perl 5 map-in-void-context version reads less well, because it relies on a side effect of the map block.</description>
		<content:encoded><![CDATA[<p>Aside from the syntax (which non-programmers wouldn&#8217;t know), I believe it reads very well.  &#8220;Total is the sum of all of the weights of every item.&#8221;</p>
<p>The Perl 5 map-in-void-context version reads less well, because it relies on a side effect of the map block.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pat</title>
		<link>http://nklein.com/2009/05/programming-when-clarity-counts/comment-page-1/#comment-36</link>
		<dc:creator>pat</dc:creator>
		<pubDate>Mon, 11 May 2009 15:08:31 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=285#comment-36</guid>
		<description>That&#039;s a great presentation.  I&#039;m on board with all of it except the Sigils.  I know that some believe that Perl&#039;s sigils make things more readable and obviate the need for Hungarian notation.  (I am not a big fan of Hungarian notation either.)  I think sigils conflate as many things as they clear up.  In particular, when one references an item in an array the &lt;em&gt;$&lt;/em&gt; sigil feels contradictory to the square-bracket indexing:

[cc]
my $item = $array_of_items[ $ii ];
[/cc]

Admittedly, something like the following would be way out of the question:

[cc]
my $item = $( @array_of_items[ $ii ] );
[/cc]

Further, sigils get flattened entirely to just &lt;em&gt;$&lt;/em&gt; when you&#039;re dealing with references.

Beyond that, I totally agree with the presentation.

Also, that was my first exposure to Moose.  Interesting...</description>
		<content:encoded><![CDATA[<p>That&#8217;s a great presentation.  I&#8217;m on board with all of it except the Sigils.  I know that some believe that Perl&#8217;s sigils make things more readable and obviate the need for Hungarian notation.  (I am not a big fan of Hungarian notation either.)  I think sigils conflate as many things as they clear up.  In particular, when one references an item in an array the <em>$</em> sigil feels contradictory to the square-bracket indexing:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">my $item = $array_of_items[ $ii ];</pre></div>
<p>Admittedly, something like the following would be way out of the question:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">my $item = $( @array_of_items[ $ii ] );</pre></div>
<p>Further, sigils get flattened entirely to just <em>$</em> when you&#8217;re dealing with references.</p>
<p>Beyond that, I totally agree with the presentation.</p>
<p>Also, that was my first exposure to Moose.  Interesting&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pat</title>
		<link>http://nklein.com/2009/05/programming-when-clarity-counts/comment-page-1/#comment-35</link>
		<dc:creator>pat</dc:creator>
		<pubDate>Mon, 11 May 2009 14:55:21 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=285#comment-35</guid>
		<description>I think the Perl 5 map version might be slightly more readable to someone who hasn&#039;t used Perl:

[cc]
my $total = 0;
map { $total += weight( $_ ) } @list_of_items;
[/cc]

It still leaves something to be desired though for clarity.</description>
		<content:encoded><![CDATA[<p>I think the Perl 5 map version might be slightly more readable to someone who hasn&#8217;t used Perl:</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><pre class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">my $total = 0;
map { $total += weight( $_ ) } @list_of_items;</pre></div>
<p>It still leaves something to be desired though for clarity.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pat</title>
		<link>http://nklein.com/2009/05/programming-when-clarity-counts/comment-page-1/#comment-34</link>
		<dc:creator>pat</dc:creator>
		<pubDate>Mon, 11 May 2009 13:11:23 +0000</pubDate>
		<guid isPermaLink="false">http://nklein.com/?p=285#comment-34</guid>
		<description>Wow.  I can see where they are coming from, but that is definitely not code for non-programmers.</description>
		<content:encoded><![CDATA[<p>Wow.  I can see where they are coming from, but that is definitely not code for non-programmers.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

