<?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"
	>
<channel>
	<title>Comments on: C# blues</title>
	<atom:link href="http://blog.yuvisense.net/2008/04/16/c-blues/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.yuvisense.net/2008/04/16/c-blues/</link>
	<description>Yuvi, a 17 year old wannabe geek from India.</description>
	<pubDate>Thu, 28 Aug 2008 06:41:09 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: sven</title>
		<link>http://blog.yuvisense.net/2008/04/16/c-blues/#comment-96825</link>
		<dc:creator>sven</dc:creator>
		<pubDate>Wed, 07 May 2008 00:58:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.yuvisense.net/2008/04/16/c-blues/#comment-96825</guid>
		<description>take a look at this:

http://blogs.msdn.com/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx

and this:

http://blogs.msdn.com/mattwar/archive/2008/05/04/mocks-nix-an-extensible-linq-to-sql-datacontext.aspx

i used these to make a linq provider for FoxPro</description>
		<content:encoded><![CDATA[<p>take a look at this:</p>
<p><a href="http://blogs.msdn.com/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx" rel="nofollow">http://blogs.msdn.com/mattwar/archive/2007/07/30/linq-building-an-iqueryable-provider-part-i.aspx</a></p>
<p>and this:</p>
<p><a href="http://blogs.msdn.com/mattwar/archive/2008/05/04/mocks-nix-an-extensible-linq-to-sql-datacontext.aspx" rel="nofollow">http://blogs.msdn.com/mattwar/archive/2008/05/04/mocks-nix-an-extensible-linq-to-sql-datacontext.aspx</a></p>
<p>i used these to make a linq provider for FoxPro</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yuvipanda</title>
		<link>http://blog.yuvisense.net/2008/04/16/c-blues/#comment-96008</link>
		<dc:creator>yuvipanda</dc:creator>
		<pubDate>Mon, 05 May 2008 05:52:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.yuvisense.net/2008/04/16/c-blues/#comment-96008</guid>
		<description>@sven: Yep, kinda, but only for *this specific problem*. I had to use datareader since I was reading from SQLite, which doesn't have a LINQ provider atm. The bigger issue at hand is us servicing the ccompiler when it should be the other way 'bout.</description>
		<content:encoded><![CDATA[<p>@sven: Yep, kinda, but only for *this specific problem*. I had to use datareader since I was reading from SQLite, which doesn&#8217;t have a LINQ provider atm. The bigger issue at hand is us servicing the ccompiler when it should be the other way &#8217;bout.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sven</title>
		<link>http://blog.yuvisense.net/2008/04/16/c-blues/#comment-95850</link>
		<dc:creator>sven</dc:creator>
		<pubDate>Sun, 04 May 2008 21:08:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.yuvisense.net/2008/04/16/c-blues/#comment-95850</guid>
		<description>i suppose this is where LINQ an anonymous types come in, huh?  too bad that stuff won't make it to mono for another, ooooh, 2 years?  (boy, i wish i was smart enough to help in the MONO project!)</description>
		<content:encoded><![CDATA[<p>i suppose this is where LINQ an anonymous types come in, huh?  too bad that stuff won&#8217;t make it to mono for another, ooooh, 2 years?  (boy, i wish i was smart enough to help in the MONO project!)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: punky</title>
		<link>http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91767</link>
		<dc:creator>punky</dc:creator>
		<pubDate>Thu, 17 Apr 2008 14:08:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91767</guid>
		<description>Yep, the innermost brackets disappeared. Funny.</description>
		<content:encoded><![CDATA[<p>Yep, the innermost brackets disappeared. Funny.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: punky</title>
		<link>http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91766</link>
		<dc:creator>punky</dc:creator>
		<pubDate>Thu, 17 Apr 2008 14:07:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91766</guid>
		<description>Hm. For some very, very strange reason, the type of the List inside the Pair inside the Set inside the Map got swallowed by your blog software (It's present in the original that I cut and pasted into this text box). Perhaps four levels of nested angle brackets are just too much?

Testing, testing: &#60;&#60;&#60;&#62;&#62;&#62;</description>
		<content:encoded><![CDATA[<p>Hm. For some very, very strange reason, the type of the List inside the Pair inside the Set inside the Map got swallowed by your blog software (It&#8217;s present in the original that I cut and pasted into this text box). Perhaps four levels of nested angle brackets are just too much?</p>
<p>Testing, testing: &lt;&lt;&lt;&gt;&gt;&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: punky</title>
		<link>http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91764</link>
		<dc:creator>punky</dc:creator>
		<pubDate>Thu, 17 Apr 2008 13:57:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91764</guid>
		<description>Heh, I guess we're talking degrees of cleanness/dirtiness here. Certainly I think it's cleanER than the original, because it gets rid of the duplication. But yeah, one of the problems with Java/C#-type languages is that we do seem to spend a lot of time throwing structures at the compiler. Incidental complexity, anyone?

I do think that statically typed languages are getting too much a flak these days, though. Certainly there is room for both statically and dynamically typed languages. But I hear you on the type inference bit, of course. Explicit typing is just such a noise generator. Genuine Java example from punky's current project: 

final Map&#60;Integer, Set&#60;Pair&#60;String, List&#62;&#62;&#62; result = new HashMap&#60;Integer, Set&#60;Pair&#60;String, List&#62;&#62;&#62;(); 

Having to type that type declaration once is bad enough... I definitely need to take a closer look at Scala soon!

I don't have any experience with VB.NET, so I'll refrain from badmouthing it. It's better to speak well of the things I like. Like list comprehensions, tuples and first-class functions in Python. Oh-wee.</description>
		<content:encoded><![CDATA[<p>Heh, I guess we&#8217;re talking degrees of cleanness/dirtiness here. Certainly I think it&#8217;s cleanER than the original, because it gets rid of the duplication. But yeah, one of the problems with Java/C#-type languages is that we do seem to spend a lot of time throwing structures at the compiler. Incidental complexity, anyone?</p>
<p>I do think that statically typed languages are getting too much a flak these days, though. Certainly there is room for both statically and dynamically typed languages. But I hear you on the type inference bit, of course. Explicit typing is just such a noise generator. Genuine Java example from punky&#8217;s current project: </p>
<p>final Map&lt;Integer, Set&lt;Pair&lt;String, List&gt;&gt;&gt; result = new HashMap&lt;Integer, Set&lt;Pair&lt;String, List&gt;&gt;&gt;(); </p>
<p>Having to type that type declaration once is bad enough&#8230; I definitely need to take a closer look at Scala soon!</p>
<p>I don&#8217;t have any experience with VB.NET, so I&#8217;ll refrain from badmouthing it. It&#8217;s better to speak well of the things I like. Like list comprehensions, tuples and first-class functions in Python. Oh-wee.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: yuvipanda</title>
		<link>http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91752</link>
		<dc:creator>yuvipanda</dc:creator>
		<pubDate>Thu, 17 Apr 2008 13:20:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91752</guid>
		<description>@punky: Is writing an entire wrapper class just to satisfy a "compiler" clean? :P

Just as you prefer Python, I prefer VB when I can :) 

TypeInfering/DuckTyped languages ftw!</description>
		<content:encoded><![CDATA[<p>@punky: Is writing an entire wrapper class just to satisfy a &#8220;compiler&#8221; clean? <img src='http://blog.yuvisense.net/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Just as you prefer Python, I prefer VB when I can <img src='http://blog.yuvisense.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>TypeInfering/DuckTyped languages ftw!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: punky</title>
		<link>http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91678</link>
		<dc:creator>punky</dc:creator>
		<pubDate>Thu, 17 Apr 2008 09:02:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91678</guid>
		<description>(I am sorry I mistyped 'public' in the previous comment, turning it into a dirty word)</description>
		<content:encoded><![CDATA[<p>(I am sorry I mistyped &#8216;public&#8217; in the previous comment, turning it into a dirty word)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: punky</title>
		<link>http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91676</link>
		<dc:creator>punky</dc:creator>
		<pubDate>Thu, 17 Apr 2008 09:01:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.yuvisense.net/2008/04/16/c-blues/#comment-91676</guid>
		<description>Perhaps this will only make your blues worse, but still: refactor away all that repetition and keep it DRY, and maybe it won't seem so dirty anymore?

Dunno if this is compilable C# (I'm in Javaland at the moment), but you should be able to make whatever minor adjustments to make the compiler happy.

class Wrapper 
{
  private DataReader dataReader;
  public Wrapper(DataReader dataReader) {
    this.dataReader = dataReader;
  }
  public string GetString(string name) {
    return dataReader[name].ToString();
  }
  public int GetInt(string name) {
    return int.Parse(GetString(name));
  }
  pubic DateTime GetDateTime(string name) {
    return new DateTime(GetInt(name));
  }
}

Then your code would read:

Wrapper w = new Wrapper(dataReader);

PID = w.GetString("PID");
UID = w.GetString("UID");
Title = w.GetString("TITLE");
Description = w.GetString("DESCRIPTION") ;

Views = w.GetInt("VIEWS") ;
Favs = w.GetInt("FAVS");
Notes = w.GetInt("NOTES");
Comments = w.GetInt("COMMENTS");

SmallURL = w.GetString("SMALLURL") ;
MediumURL = w.GetString("MEDIUMURL") ;
LargeURL = w.GetString("LARGEURL") ;
PhotoURL = w.GetString("PHOTOURL") ;

TakenOn = w.GetDateTime("TAKENON");
PostedOn = w.GetDateTime("POSTEDON");
MadeExploreOn = w.GetDateTime("MADEEXPLOREON");

Which seems reasonably clean to me. Of course, I also prefer to use Python over Java if and when I can :-)</description>
		<content:encoded><![CDATA[<p>Perhaps this will only make your blues worse, but still: refactor away all that repetition and keep it DRY, and maybe it won&#8217;t seem so dirty anymore?</p>
<p>Dunno if this is compilable C# (I&#8217;m in Javaland at the moment), but you should be able to make whatever minor adjustments to make the compiler happy.</p>
<p>class Wrapper<br />
{<br />
  private DataReader dataReader;<br />
  public Wrapper(DataReader dataReader) {<br />
    this.dataReader = dataReader;<br />
  }<br />
  public string GetString(string name) {<br />
    return dataReader[name].ToString();<br />
  }<br />
  public int GetInt(string name) {<br />
    return int.Parse(GetString(name));<br />
  }<br />
  pubic DateTime GetDateTime(string name) {<br />
    return new DateTime(GetInt(name));<br />
  }<br />
}</p>
<p>Then your code would read:</p>
<p>Wrapper w = new Wrapper(dataReader);</p>
<p>PID = w.GetString(&#8221;PID&#8221;);<br />
UID = w.GetString(&#8221;UID&#8221;);<br />
Title = w.GetString(&#8221;TITLE&#8221;);<br />
Description = w.GetString(&#8221;DESCRIPTION&#8221;) ;</p>
<p>Views = w.GetInt(&#8221;VIEWS&#8221;) ;<br />
Favs = w.GetInt(&#8221;FAVS&#8221;);<br />
Notes = w.GetInt(&#8221;NOTES&#8221;);<br />
Comments = w.GetInt(&#8221;COMMENTS&#8221;);</p>
<p>SmallURL = w.GetString(&#8221;SMALLURL&#8221;) ;<br />
MediumURL = w.GetString(&#8221;MEDIUMURL&#8221;) ;<br />
LargeURL = w.GetString(&#8221;LARGEURL&#8221;) ;<br />
PhotoURL = w.GetString(&#8221;PHOTOURL&#8221;) ;</p>
<p>TakenOn = w.GetDateTime(&#8221;TAKENON&#8221;);<br />
PostedOn = w.GetDateTime(&#8221;POSTEDON&#8221;);<br />
MadeExploreOn = w.GetDateTime(&#8221;MADEEXPLOREON&#8221;);</p>
<p>Which seems reasonably clean to me. Of course, I also prefer to use Python over Java if and when I can <img src='http://blog.yuvisense.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
</channel>
</rss>
