<?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: C# vs Java Part 1: The Languages (Continued)</title>
	<atom:link href="http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/feed/" rel="self" type="application/rss+xml" />
	<link>http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/</link>
	<description>Software Development from John Sonmez&#039;s Perspective</description>
	<lastBuildDate>Tue, 27 Jul 2010 15:11:32 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: jsonmez</title>
		<link>http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/#comment-125</link>
		<dc:creator>jsonmez</dc:creator>
		<pubDate>Mon, 15 Feb 2010 16:53:48 +0000</pubDate>
		<guid isPermaLink="false">http://simpleprogrammer.com/?p=292#comment-125</guid>
		<description>Hi Chris,

You are correct about the generics.  I think C# is getting support for &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms173174(VS.80).aspx&quot; rel=&quot;nofollow&quot;&gt;contravariance and covariance&lt;/a&gt; in 4.0, which should all something that takes base type of a generic to take a subtype.

The Java enums are a bit heavy, but it is pretty useful when you need it.  I agree with you that there might be a better solution, but between the two I have to go with the Java implementation.</description>
		<content:encoded><![CDATA[<p>Hi Chris,</p>
<p>You are correct about the generics.  I think C# is getting support for <a href="http://msdn.microsoft.com/en-us/library/ms173174(VS.80).aspx" rel="nofollow">contravariance and covariance</a> in 4.0, which should all something that takes base type of a generic to take a subtype.</p>
<p>The Java enums are a bit heavy, but it is pretty useful when you need it.  I agree with you that there might be a better solution, but between the two I have to go with the Java implementation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/#comment-124</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 15 Feb 2010 04:48:54 +0000</pubDate>
		<guid isPermaLink="false">http://simpleprogrammer.com/?p=292#comment-124</guid>
		<description>One thing you&#039;re missing from the Generics section which does favour Java is wildcards. Allows ArrayList to &quot;inherit&quot; (term used loosely) from ArrayList when Foo inherits from Bar.
I think c# 4.0 is getting something similar.

Also I disagree about Enums, as much as I&#039;m not a huge fan of C# Enums (too lightweight) I think Java ones are just as annoying but in a completely different way (too heavy).</description>
		<content:encoded><![CDATA[<p>One thing you&#8217;re missing from the Generics section which does favour Java is wildcards. Allows ArrayList to &#8220;inherit&#8221; (term used loosely) from ArrayList when Foo inherits from Bar.<br />
I think c# 4.0 is getting something similar.</p>
<p>Also I disagree about Enums, as much as I&#8217;m not a huge fan of C# Enums (too lightweight) I think Java ones are just as annoying but in a completely different way (too heavy).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: C# vs Java Part 2: The Platforms (Desktop and Mobile) &#171; Making the Complex Simple</title>
		<link>http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/#comment-85</link>
		<dc:creator>C# vs Java Part 2: The Platforms (Desktop and Mobile) &#171; Making the Complex Simple</dc:creator>
		<pubDate>Mon, 08 Feb 2010 08:02:24 +0000</pubDate>
		<guid isPermaLink="false">http://simpleprogrammer.com/?p=292#comment-85</guid>
		<description>[...] C# vs Java Part 1: The Languages (Continued) [...]</description>
		<content:encoded><![CDATA[<p>[...] C# vs Java Part 1: The Languages (Continued) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blair Zajac</title>
		<link>http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/#comment-81</link>
		<dc:creator>Blair Zajac</dc:creator>
		<pubDate>Sat, 06 Feb 2010 22:01:01 +0000</pubDate>
		<guid isPermaLink="false">http://simpleprogrammer.com/?p=292#comment-81</guid>
		<description>Following up to my comment in your previous post, here&#039;s the Scala code.

56.toString

Scala 2.8 has manifest types which allow you to reflect on the type parameter T so some of the examples you show there are possible.

Scala doesn&#039;t have checked exceptions.

Scala&#039;s for comprehensions allow you to write the kind of code that LINQ&#039;s magic is for.

val query = names.filter(_.length == 5).sorted.map(_.toUpperCase)

Scala has type inference so you don&#039;t need to specify types in many places.

Scala has implicits that let you add methods to any class and pick the scope where those additional methods are visible.  For example, Scala has a RichString class that has additional methods beyond String.  It&#039;s not like Ruby where if you extend a class the entire process sees those modifications, in Scala, the additional methods are only visible where you want them and it&#039;s done at compile time.

Regards,
Blair</description>
		<content:encoded><![CDATA[<p>Following up to my comment in your previous post, here&#8217;s the Scala code.</p>
<p>56.toString</p>
<p>Scala 2.8 has manifest types which allow you to reflect on the type parameter T so some of the examples you show there are possible.</p>
<p>Scala doesn&#8217;t have checked exceptions.</p>
<p>Scala&#8217;s for comprehensions allow you to write the kind of code that LINQ&#8217;s magic is for.</p>
<p>val query = names.filter(_.length == 5).sorted.map(_.toUpperCase)</p>
<p>Scala has type inference so you don&#8217;t need to specify types in many places.</p>
<p>Scala has implicits that let you add methods to any class and pick the scope where those additional methods are visible.  For example, Scala has a RichString class that has additional methods beyond String.  It&#8217;s not like Ruby where if you extend a class the entire process sees those modifications, in Scala, the additional methods are only visible where you want them and it&#8217;s done at compile time.</p>
<p>Regards,<br />
Blair</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jsonmez</title>
		<link>http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/#comment-73</link>
		<dc:creator>jsonmez</dc:creator>
		<pubDate>Thu, 04 Feb 2010 23:07:07 +0000</pubDate>
		<guid isPermaLink="false">http://simpleprogrammer.com/?p=292#comment-73</guid>
		<description>You are correct.  This is kind of strange though.  In the CLI standard it says:

12.4.2.5 Overview of exception handling
See the exception handling specification in Partition II for details.
Each method in an executable has associated with it a (possibly empty) array of exception handling
information. Each entry in the array describes a protected block, its filter, and its handler (which shall be a
catch handler, a filter handler, a finally handler, or a fault handler). When an exception occurs, the CLI
searches the array for the first protected block that
• Protects a region including the current instruction pointer and
• Is a catch handler block and
• Whose filter wishes to handle the exception
&lt;strong&gt;If a match is not found in the current method, the calling method is searched, and so on. If no match is found
the CLI will dump a stack trace and abort the program.&lt;/strong&gt;
[Note: A debugger can intervene and treat this situation like a breakpoint, before performing any stack
unwinding, so that the stack is still available for inspection through the debugger. end note]
If a match is found, the CLI walks the stack back to the point just located, but this time calling the finally and
fault handlers. It then starts the corresponding exception handler. Stack frames are discarded either as this
second walk occurs or after the handler completes, depending on information in the exception handler array
entry associated with the handling block.

Yet, I have created a small program that does:

[sourcecode language=&quot;csharp&quot;]
try
            {
                Console.Out.WriteLine(&quot;In Try&quot;);
                throw new Exception();
            }
            finally
            {
                Console.Out.WriteLine(&quot;In Finally&quot;);
            }
[/sourcecode]

Which outputs:

In Try

Unhandled Exception: System.Exception: ...

In Finally

So it obviously does call the finally block.  I will update the post to reflect that.  Thanks for bringing that point up.</description>
		<content:encoded><![CDATA[<p>You are correct.  This is kind of strange though.  In the CLI standard it says:</p>
<p>12.4.2.5 Overview of exception handling<br />
See the exception handling specification in Partition II for details.<br />
Each method in an executable has associated with it a (possibly empty) array of exception handling<br />
information. Each entry in the array describes a protected block, its filter, and its handler (which shall be a<br />
catch handler, a filter handler, a finally handler, or a fault handler). When an exception occurs, the CLI<br />
searches the array for the first protected block that<br />
• Protects a region including the current instruction pointer and<br />
• Is a catch handler block and<br />
• Whose filter wishes to handle the exception<br />
<strong>If a match is not found in the current method, the calling method is searched, and so on. If no match is found<br />
the CLI will dump a stack trace and abort the program.</strong><br />
[Note: A debugger can intervene and treat this situation like a breakpoint, before performing any stack<br />
unwinding, so that the stack is still available for inspection through the debugger. end note]<br />
If a match is found, the CLI walks the stack back to the point just located, but this time calling the finally and<br />
fault handlers. It then starts the corresponding exception handler. Stack frames are discarded either as this<br />
second walk occurs or after the handler completes, depending on information in the exception handler array<br />
entry associated with the handling block.</p>
<p>Yet, I have created a small program that does:</p>
<pre class="brush: csharp;">
try
            {
                Console.Out.WriteLine(&quot;In Try&quot;);
                throw new Exception();
            }
            finally
            {
                Console.Out.WriteLine(&quot;In Finally&quot;);
            }
</pre>
<p>Which outputs:</p>
<p>In Try</p>
<p>Unhandled Exception: System.Exception: &#8230;</p>
<p>In Finally</p>
<p>So it obviously does call the finally block.  I will update the post to reflect that.  Thanks for bringing that point up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: J</title>
		<link>http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/#comment-71</link>
		<dc:creator>J</dc:creator>
		<pubDate>Thu, 04 Feb 2010 22:35:36 +0000</pubDate>
		<guid isPermaLink="false">http://simpleprogrammer.com/?p=292#comment-71</guid>
		<description>Your statement about finally blocks not running in C# is incorrect. Finally blocks run regardless of whether the try block throws an exception that is caught or uncaught.</description>
		<content:encoded><![CDATA[<p>Your statement about finally blocks not running in C# is incorrect. Finally blocks run regardless of whether the try block throws an exception that is caught or uncaught.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pop Catalin</title>
		<link>http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/#comment-69</link>
		<dc:creator>Pop Catalin</dc:creator>
		<pubDate>Thu, 04 Feb 2010 09:57:04 +0000</pubDate>
		<guid isPermaLink="false">http://simpleprogrammer.com/?p=292#comment-69</guid>
		<description>Hey,
Stackoverflow podcast listener here. I guess it worked :) some traffic to your blog.</description>
		<content:encoded><![CDATA[<p>Hey,<br />
Stackoverflow podcast listener here. I guess it worked <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  some traffic to your blog.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EF Vincent</title>
		<link>http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/#comment-66</link>
		<dc:creator>EF Vincent</dc:creator>
		<pubDate>Thu, 04 Feb 2010 05:02:57 +0000</pubDate>
		<guid isPermaLink="false">http://simpleprogrammer.com/?p=292#comment-66</guid>
		<description>One more note, a nullable value type like int? you mention is shorthand (aka syntactic sugar) for the generic struct Nullable. So:

int? i = 0;
Nullable j = 0;

(i.GetType() == j.GetType()) == true;

I agree with some of the other commenters that the nullable value types are most often used in database scenarios, but sometimes the abstraction is useful to represent the lack of information even in non database contexts.</description>
		<content:encoded><![CDATA[<p>One more note, a nullable value type like int? you mention is shorthand (aka syntactic sugar) for the generic struct Nullable. So:</p>
<p>int? i = 0;<br />
Nullable j = 0;</p>
<p>(i.GetType() == j.GetType()) == true;</p>
<p>I agree with some of the other commenters that the nullable value types are most often used in database scenarios, but sometimes the abstraction is useful to represent the lack of information even in non database contexts.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Asad Ali Butt</title>
		<link>http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/#comment-65</link>
		<dc:creator>Asad Ali Butt</dc:creator>
		<pubDate>Wed, 03 Feb 2010 20:49:44 +0000</pubDate>
		<guid isPermaLink="false">http://simpleprogrammer.com/?p=292#comment-65</guid>
		<description>Thanks for this very nice post. This series will support some of the arguments I had with my mate. I have worked in java and enjoyed it but i was always amazed to hear my team manager advising us to use some internal API (organizational) for some of the very comon purpose and jdk had one arround to solve the problem for ages.

 I always wondered why have my organisation has done this extra work for. But to be honest, for every  java based open source ApI out there, I realised it is not worth to go for one until its third release or over.

 Finally switched to C# and programming happily ever after. One language, One ID and focused.</description>
		<content:encoded><![CDATA[<p>Thanks for this very nice post. This series will support some of the arguments I had with my mate. I have worked in java and enjoyed it but i was always amazed to hear my team manager advising us to use some internal API (organizational) for some of the very comon purpose and jdk had one arround to solve the problem for ages.</p>
<p> I always wondered why have my organisation has done this extra work for. But to be honest, for every  java based open source ApI out there, I realised it is not worth to go for one until its third release or over.</p>
<p> Finally switched to C# and programming happily ever after. One language, One ID and focused.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jsonmez</title>
		<link>http://simpleprogrammer.com/2010/02/02/c-vs-java-part-1-the-languages-continued/#comment-63</link>
		<dc:creator>jsonmez</dc:creator>
		<pubDate>Wed, 03 Feb 2010 14:26:44 +0000</pubDate>
		<guid isPermaLink="false">http://simpleprogrammer.com/?p=292#comment-63</guid>
		<description>You are correct there.  That is part of the reason I am unsure about nullable primatives.  It is very good in working with databases, where nulls are part of the domain.  In fact that is exactly where I have used nullable types myself and found them to save huge amounts of repetitive code.  The problem is that these nullable types really shouldn&#039;t bubble up past the data access layer, and make their way into the main code base or business logic.  The less we have to worry about null, the simpler our code can be.</description>
		<content:encoded><![CDATA[<p>You are correct there.  That is part of the reason I am unsure about nullable primatives.  It is very good in working with databases, where nulls are part of the domain.  In fact that is exactly where I have used nullable types myself and found them to save huge amounts of repetitive code.  The problem is that these nullable types really shouldn&#8217;t bubble up past the data access layer, and make their way into the main code base or business logic.  The less we have to worry about null, the simpler our code can be.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
