Talk:Comparison of C Sharp and Java: Difference between revisions

Content deleted Content added
MiszaBot I (talk | contribs)
m Robot: Archiving 2 threads (older than 90d) to Talk:Comparison of C Sharp and Java/Archive 3.
rv test
 
(100 intermediate revisions by 41 users not shown)
Line 1:
{{WikiProject Java|importance=low|class=start|peer-review=yes}}
{{Peer review|archive=1}}
{{User:MiszaBot/config
|archiveheader = {{aan}}
Line 9 ⟶ 7:
|archive = Talk:Comparison of C Sharp and Java/Archive %(counter)d
}}
{{WikiProject banner shell|class=List|
{{User:WildBot/m04|sect={{User:WildBot/m03|1|Comparison of Java and C Sharp#Arbitrary size numbers|below|#Arbitrary size numbers}}, {{User:WildBot/m03|1|Comparison of Java and C Sharp#Enumerated types|Enumerated types|#Enumerated types}}, {{User:WildBot/m03|1|Comparison of Java and C Sharp#Event handling|event handling|#Event handling}}, {{User:WildBot/m03|1|Comparison of Java and C Sharp#Functional programming|Functional programming|#Functional programming}}, {{User:WildBot/m03|1|Comparison of Java and C Sharp#Nullable types|Lifted (nullable) types|#Nullable types}}, {{User:WildBot/m03|1|Comparison of Java and C Sharp#Runtime binding|Runtime (dynamic) binding|#Runtime binding}}, {{User:WildBot/m03|1|Comparison of Java and C Sharp#Runtime type information and -manipulation|Runtime type information and -manipulation|#Runtime type information and -manipulation}}, {{User:WildBot/m03|1|Comparison of Java and C Sharp#Tuples|Tuple|#Tuples}}|m04}}
{{WikiProject Java |importance=low}}
{{User:WildBot/m01|dabs={{User:WildBot/m03|1|CLR}}, {{User:WildBot/m03|1|generics}}|m01}}
{{WikiProject Computing |auto=}}
{{Archive box |search=yes |bot=MiszaBot I |age=3 |units=months |
}}
* [[Talk:Comparison of Java and C Sharp/Archive 1|Archive 1]] <small>(2005–2008)</small>
{{Archives |bot=Lowercase sigmabot III |age=3 |units=months }}
* [[/Archive 2|Archive 2]] <small>(2009– )</small>
{{Broken anchors|links=
* <nowiki>[[Arbitrary-precision arithmetic#Arbitrary-precision software|software for arbitrary-precision arithmetic]]</nowiki> The anchor (#Arbitrary-precision software) [[Special:Diff/633704642|has been deleted]]. <!-- {"title":"Arbitrary-precision software","appear":{"revid":33896264,"parentid":33891953,"timestamp":"2006-01-04T22:34:11Z","removed_section_titles":["Uses","Software examples"],"added_section_titles":["Applications","Algorithms","Arbitrary-precision software"]},"disappear":{"revid":633704642,"parentid":632305701,"timestamp":"2014-11-13T19:24:31Z","removed_section_titles":["Arbitrary-precision software","Libraries","Stand-alone application software","Languages"],"added_section_titles":["Software libraries"]}} -->
}}
__TOC__
 
== Simplicity vs. feature richness ==
 
Wikipedia is great for beeing _SIMPLE_ not for beeing "feature rich". This article evaluates C# as better, because it has more features, than Java. The "missing" features of Java are marked red. Diplomatically speaking, this approach is not very clever. [[Special:Contributions/193.165.212.242|193.165.212.242]] ([[User talk:193.165.212.242|talk]]) 11:54, 14 November 2011 (UTC) ([[:cs:User:Pteryx]])
 
The tone of the article makes it seem heavily biased towards C# because it has features that Java doesn't - ignoring whether Java would actually benefit from these features or not, and the fact that the vast majority of them were deliberately left out because of design principles of the language. Then lo and behold when a feature comes along that's in Java and NOT in C# (checked exceptions for instance) the article launches straight into talking about all the disadvantages of checked exceptions! And when the opposite happens, such as with LINQ, the article discusses all the positives about it.
 
This article has the potential to be good, however at the moment it's nothing more than a load of biased waffle. I use both C# and Java extensively and have no bias towards one or the other, but this page definitely does. [[Special:Contributions/86.26.141.146|86.26.141.146]] ([[User talk:86.26.141.146|talk]]) 17:31, 1 January 2012 (UTC)
 
:Once again (see below): this article compares two languages by listing their features and mentioning alternatives on the other side. Because C# has more features than Java, C# comes out as ... well, having more features. There is no bias in that whatsoever. Commenters like you keep coming here on how the article is 'biased towards' C#. I don't see any such bias. Please point it out. There definitely needs to be an opinion piece to explain to people using software that more features doesn't always equate better, but this article is not the place for that, I think. [[User:Rp|Rp]] ([[User talk:Rp|talk]]) 18:05, 3 January 2012 (UTC)
 
::<font face="Lucida Console">'''Article.isBiased() == false;'''</font> C# is simply a newer language than Java and thus has more features, because the C# programmers thought of stuff that the Java guys didn't. But that doesn't make it better. How it's ''used'' is important as well. Cheers, [[User talk:68.173.113.106|The Doctahedron]], 00:42, 24 January 2012 (UTC)
 
:I use both Java and C#. I prefer C# solely for its support of events. Now I've seen events in old Pascal code, so they aren't exactly a new concept - I know that this is just one example of a feature that Java is missing, but is it really that biased to point it out? After all, C# support on mobile phones is inexistent in most cases, and poor on Android - is there any free C# compiler for Android? This "missing feature" for C# is also pointed out in the article, along with arbitrary-length floats. Yes, Java has a lot of red boxes in that list, but that doesn't mean that the list is biased - just that Java has less features than C#. We could compare C# and Java to x86 assembly, and assembly would be almost a solid pane of red boxes - but this doesn't mean that it is worse or inferior, just that it is intended for a different purpose. [[Special:Contributions/90.194.203.69|90.194.203.69]] ([[User talk:90.194.203.69|talk]]) 12:39, 16 February 2012 (UTC)
 
::My understanding was that this is supposed to be a discussion about the semantics of the language, and that the underlying platforms were compared elsewhere. C# has language-level support for a lot of things Java doesn't, so a feature-comparison (an objective way to compare the two) will intrinsically favor C#. <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/152.23.122.74|152.23.122.74]] ([[User talk:152.23.122.74|talk]]) 20:59, 2 May 2012 (UTC)</span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
 
:I used both C# and Java after a long time with C++. I think the debiasing of the article should be done by ''explaining'' the differences of the two languages, not only enlisting them, which has been done at some places where it is written that delegates, for instance, have been deliberately left out. Like in this example, if Java is "missing" some features because it is older, this should be clearified and referenced. If a feature has been deliberately left, again, a referenced information is needed. And I propose to use a four-colour scheme so that deliberately left out features are marked with a colour different than green, yellow, or red.
:I think this discussion here shows that the article ''seems'' to be biased, but actually lacks referenced clarifications. As I used Java around two years and C# less than a year in projects, I think others with more experience would be more appropriate for the job of adding the missing information. To the experts: Please, please do not forget that you are writing for an encyclopedia. I plead to the prophets of both languages to add facts, if they are interested to add anything, and not a list of dogmas. [[User:Sae1962|Sae1962]] ([[User talk:Sae1962|talk]]) 10:25, 3 September 2012 (UTC)
 
I think that the article is no more biased. I plead to remove the marking that it is biased. [[User:Sae1962|Sae1962]] ([[User talk:Sae1962|talk]]) 15:06, 12 September 2012 (UTC)
 
:Be bold, go ahead and remove it. I do think the article still has other issues, though. Mostly structural, but there is also the pesky problem of agreeing on where the language stops and the framework begins. [[User:Useerup|Useerup]] ([[User talk:Useerup|talk]]) 19:19, 12 September 2012 (UTC)
 
== Contradiction ==
 
In [[{{PAGENAME}}#Features|section 1.1 Features]], it says that Java has a <code>Decimal128</code> data type:
 
{| class="wikitable" style="width:80%;"
|-
! style="width:40%;"|[[#Data types|Data types]]!! style="width:30%;"|Java !! style="width:30%;"|C#
|-
|IEEE 754 [[binary32]] floating point number||{{yes}}||{{yes}}
|-
|IEEE 754 [[binary64]] floating point number||{{yes}}||{{yes}}
|-
|'''High precision floating point number'''||{{yes|128-bit (28 digits) Decimal type}}||{{yes|128-bit (28 digits) Decimal type}}
|}
 
The simple answer, as stated in [[{{PAGENAME}}#Simple/primitive types|section 1.3.2 Primitive types]] is NO. Don't worry, I already fixed it. [[Special:Contributions/68.173.113.106|68.173.113.106]] ([[User talk:68.173.113.106|talk]]) 03:29, 2 March 2012 (UTC)
 
::I'm adding a "yes (BigDecimal class)". It's a class rather than a primitive, but it's part of standard Java. The distinction is arguably ignorable; e.g. you wouldn't say "scala has no number types at all" because they're all classes. <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/94.174.207.151|94.174.207.151]] ([[User talk:94.174.207.151|talk]]) 06:09, 6 September 2012 (UTC)</span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
:::BigDecimal was already represented in the table. Java does not have a simple/primitive type with high precision. It has a arbitrarily high precision type in the class library (which C# does not). All of this is represented in the table. [[User:Useerup|Useerup]] ([[User talk:Useerup|talk]]) 08:22, 13 September 2012 (UTC)
 
== Please PR this page ==
 
Please [[wikipedia:Peer Review|Peer Review]] this page. Thanks! [[Special:Contributions/68.173.113.106|68.173.113.106]] ([[User talk:68.173.113.106|talk]]) 01:13, 10 March 2012 (UTC)
 
== Dubious claim about both languages not supporting arithmetic on all types ==
 
This claim is wrong. The issue illustrated by the examples is that the languages do not support byte ''literals'' - i.e. a sequence of digits form an ''integer'' literal - which cannot be cast to byte without loss. Consequently, invoking an arithmetic operator on a byte (variable) and an integer (literal) promotes the byte to integer (in *both* languages) and performs an integer operation. The result is an integer which - naturally - is not compatible with a byte.
 
The corresponding problem exists with the claim about the float type. Here the float gets promoted to a double - which is not assignment compatible with float/single.
 
I suggest removing this section as it is incorrect and misleading. [[User:Useerup|Useerup]] ([[User talk:Useerup|talk]]) 08:20, 13 September 2012 (UTC)
 
 
:On second thought I moved the section here so that we can correct it before deciding where (and if) it belongs in the article:
 
--- begin section ---
 
== Modules ==
Both languages do not directly allow arithmetical operations on all primitive types, as they arbitrarily default to <code>int</code> or <code>double</code>:
 
A section is missing: what are the differences between java's packages and C#'s public/internal visibility keywords on namespace members (which end up correlating with the CLR's modules and assemblies). [[User:Bohan|Bohan]] ([[User talk:Bohan|talk]]) 12:21, 28 July 2018 (UTC)
{| class="wikitable"
|-
! Java !! C#
|-
|<source lang=Java>
byte value = 2;
float price = 5;
 
== Type inference / manifested ==
price++;
value++;
// Type mismatch: cannot convert from int to byte
value = value + 4; // <<<
value += 5;
// Type mismatch: cannot convert from double to float
price = 5.7; // <<<
</source>|| <source lang=CSharp>
byte value = 2;
float price = 5;
 
At least C# supports basic type inference support: https://stackoverflow.com/questions/479883/how-good-is-the-c-sharp-type-inference [[User:ShalokShalom|ShalokShalom]] ([[User talk:ShalokShalom|talk]])
price++;
value++;
// Error: conversion from int to byte
value = value + 4; // <<<
value += 5;
// Error: conversion from double to float
price = 5.7; // <<<
</source>
|}
 
== Comparing Stream API and LINQ ==
--- end section ---
There is a paragraph for LINQ but not for the Java Stream API. Comparing them would be more consistent with the rest of the article. I might add this part in the future but don't have time right now <!-- Template:Unsigned IP --><small class="autosigned">—&nbsp;Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/141.79.34.38|141.79.34.38]] ([[User talk:141.79.34.38#top|talk]]) 23:41, 21 January 2024 (UTC)</small> <!--Autosigned by SineBot-->