<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Properly Abstracted List APIs (in C#)</title>
	<atom:link href="http://mullr.wordpress.com/2007/09/17/properly-abstracted-list-apis-in-c/feed/" rel="self" type="application/rss+xml" />
	<link>http://mullr.wordpress.com/2007/09/17/properly-abstracted-list-apis-in-c/</link>
	<description>fixing bugs, taking names</description>
	<lastBuildDate>Mon, 02 Mar 2009 16:53:20 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Mark</title>
		<link>http://mullr.wordpress.com/2007/09/17/properly-abstracted-list-apis-in-c/#comment-35</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Tue, 09 Oct 2007 22:03:12 +0000</pubDate>
		<guid isPermaLink="false">http://mullr.wordpress.com/2007/09/17/properly-abstracted-list-apis-in-c/#comment-35</guid>
		<description>Nice solution. Thought I would point out a minor typo. 

In the Accessor Delegate example you have:
delegate(StockQuote q) { return q.date.price; } );  

which should be:
delegate(StockQuote q) { return q.price; } );  

I do like the example. Delegates continue to elude me and this helps.</description>
		<content:encoded><![CDATA[<p>Nice solution. Thought I would point out a minor typo. </p>
<p>In the Accessor Delegate example you have:<br />
delegate(StockQuote q) { return q.date.price; } );  </p>
<p>which should be:<br />
delegate(StockQuote q) { return q.price; } );  </p>
<p>I do like the example. Delegates continue to elude me and this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vitali</title>
		<link>http://mullr.wordpress.com/2007/09/17/properly-abstracted-list-apis-in-c/#comment-29</link>
		<dc:creator>Vitali</dc:creator>
		<pubDate>Fri, 05 Oct 2007 13:10:00 +0000</pubDate>
		<guid isPermaLink="false">http://mullr.wordpress.com/2007/09/17/properly-abstracted-list-apis-in-c/#comment-29</guid>
		<description>good post!

your remark about a a large number of accessors is correct.  it doesn&#039;t feel right to pass 10 accessor delegates parameters.  But you can fix it by combining this approach with  .. interfaces. 
(I&#039;m not a c# expert so here is a java equivalent)
library:
&lt;code&gt;
interface ChartInfo {
   int getX(T o);
   int getY(T o);
}
 Chart CreateChart(List items, ChartInfo info);
&lt;/code&gt;
client:
&lt;code&gt;
ChartAPI.CreateChart(quotes, new ChartInfo() {
   public int getX(StockQuote  q) {
     return q.date.DayOfYear;
   }
   public int getY(StockQuote  q) {
     return q.date.price;
   }
});  
&lt;/code&gt;

Now you can add more methods to ChartInfo interface which will still look reasonably clean.

Also to optimize a number of calls you can do

interface ChartInfo {
   Point getPosition(T o);
}

Cheers,
Vitali</description>
		<content:encoded><![CDATA[<p>good post!</p>
<p>your remark about a a large number of accessors is correct.  it doesn&#8217;t feel right to pass 10 accessor delegates parameters.  But you can fix it by combining this approach with  .. interfaces.<br />
(I&#8217;m not a c# expert so here is a java equivalent)<br />
library:<br />
<code><br />
interface ChartInfo {<br />
   int getX(T o);<br />
   int getY(T o);<br />
}<br />
 Chart CreateChart(List items, ChartInfo info);<br />
</code><br />
client:<br />
<code><br />
ChartAPI.CreateChart(quotes, new ChartInfo() {<br />
   public int getX(StockQuote  q) {<br />
     return q.date.DayOfYear;<br />
   }<br />
   public int getY(StockQuote  q) {<br />
     return q.date.price;<br />
   }<br />
});<br />
</code></p>
<p>Now you can add more methods to ChartInfo interface which will still look reasonably clean.</p>
<p>Also to optimize a number of calls you can do</p>
<p>interface ChartInfo {<br />
   Point getPosition(T o);<br />
}</p>
<p>Cheers,<br />
Vitali</p>
]]></content:encoded>
	</item>
</channel>
</rss>
