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

Content deleted Content added
Useerup (talk | contribs)
rv test
 
(37 intermediate revisions by 20 users not shown)
Line 1:
{{WikiProject Java|importance=low|class=start|peer-review=yes}}
{{User:MiszaBot/config
|archiveheader = {{aan}}
Line 8 ⟶ 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}}
 
{{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–2011)</small>
{{Broken anchors|links=
* [[/Archive 3|Archive 3]] <small>(2012– )</small>
* <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__
 
== Speed/performance comparison ==
 
Microsoft bans benchmarking .NET Framework without their written permission: [http://msdn.microsoft.com/en-us/library/ms973265.aspx Microsoft .NET Framework Benchmark Testing Terms]. And Mono is not the official .NET implementation to compare with Oracle Java. That's why adding speed/performance comparison to this article is not correct. So, based on above facts remove this section, please.[[Special:Contributions/69.18.50.2|69.18.50.2]] ([[User talk:69.18.50.2|talk]]) 10:07, 2 December 2012 (UTC) cs_student
 
:I still think performance would be an aspect readers would find relevant. I agree that the section as it stands now is misleading. We could remove it, but we could also try to work in the caveats you mention. Would you care to try? [[User:Useerup|Useerup]] ([[User talk:Useerup|talk]]) 11:29, 2 December 2012 (UTC)
:: The only implementation where its allowed to benchmark results for C# is Mono. Yet C# is shown supported on a variety of platforms in this article because of Mono. Plus the paragraph (at least now) shows clearly that the comparison is made with Mono. I don't know why it should be removed. [[User:Hervegirod|Hervegirod]] ([[User talk:Hervegirod|talk]]) 09:31, 20 December 2012 (UTC)
:::As I wrote, I absolutely believe the issue is relevant. There are some (very) old perf tests showing that .NET is faster than Java on Windows. They are dated and are probably not representative of the current state, and I'm not comfortable mentioning that in the paragraph. I would prefer that the article explain that there very well could be differences between the 1st party implementation and Mono but that there's no comparison data available because of the licensing terms. [[User:Useerup|Useerup]] ([[User talk:Useerup|talk]]) 12:11, 20 December 2012 (UTC)
:A contractual ban on benchmark publishing seems like an antitrust violation that Microsoft could easily use to ensure that the only benchmarks that get published are ones that favor the .NET framework. That said, we have no reason to submit to their will. [[Special:Contributions/68.173.113.106|68.173.113.106]] ([[User talk:68.173.113.106|talk]]) 20:50, 21 July 2013 (UTC)
 
I updated this section to match the current link, Microsoft has changed their position on benchmarking should someone want to try to find references, seems they are mostly comparable from what I can tell.
 
 
5/24/2013: I removed this section[[User:Evolvedmicrobe|Evolvedmicrobe]] ([[User talk:Evolvedmicrobe|talk]]) 21:18, 24 May 2013 (UTC). Although I believe this is HIGHLY relevant to a comparison between the two and would love to see someone put it back in with a more thought out section. I thought it suffered from the following problems.
 
1 - The style and content of the opening paragraph was not up to par. This statement came off as pretty vacuous: ''"Comparing language speed is tricky. It depends on the virtual machine and the environment used. It can also depend on whether the benchmark code was written in an idiomatic or an optimised style."''
 
2 - The benchmark tests given are not useful. Java and C# are such similar languages that it should have been possible to directly compare them by essentially writing the same program line for line. However the algorithms/code used in these benchmarks differs substantially (for example, encoding things as bytes versus unicode characters, writing multi-threaded versus single threaded applications, optimization switches, etc.). The largest difference between Mono/Java (Binary trees test) is entirely an artifact of mono being run with an outdated version of the garbage collector, and the more common microsoft implementation shows essentially no difference at all for that test.
 
I would love to see a more rigourous section developed here. This article: http://www.itu.dk/~sestoft/papers/numericperformance.pdf seems like it could be a good start, though it only focuses on numeric computations, and it seems comparing garbage collectors, native interopt, memory usage, etc. would all be important.
 
Unless the article can say something meaningful, well supported, and useful, I think this section should remain out. <small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Evolvedmicrobe|Evolvedmicrobe]] ([[User talk:Evolvedmicrobe|talk]] • [[Special:Contributions/Evolvedmicrobe|contribs]]) 21:15, 24 May 2013 (UTC)</span></small><!-- Template:Unsigned --> <!--Autosigned by SineBot-->
 
Addendum: Just noticed the article title says it is only comparing Microsoft to Oracle, I think we should expand that to Mono and IBM so we can add this performance section. <small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Evolvedmicrobe|Evolvedmicrobe]] ([[User talk:Evolvedmicrobe|talk]] • [[Special:Contributions/Evolvedmicrobe|contribs]]) 21:44, 24 May 2013 (UTC)</span></small><!-- Template:Unsigned --> <!--Autosigned by SineBot-->
 
== Page Is Irrelevent ==
 
Is Wikipedia in the business of providing competing product comparisons?
 
These are two proprietary products produced by competing corporations. The features in both products are subject to change based on the owners goals and marketing decisions without public input. Thus many of the details are volitile and the article will quickly go stale. There are already inaccuracies on both sides of the comparison some due to the age of the article and others intended to skew the article.
 
The features comparison colors the yes and no values green and red respectively. This is an immediate value judgement on the included of featues. Due to this red/green coloring a minority of the tables of features have more red boxes on the C# side than the Java side. A simple glance at this bias reveals an immediate inference that C# is better than Java, despite many of the features that are not in Java are conscious design decision by Sun/Oracle.
 
It could be said that Microsoft has taken a kitchen sink approach to language design while Sun/Oracle has taken a more measured approach to feature inclusion. This is implied by the discussion about keyword growth in Java vs C#. So, as a common comparing any two languages in computer science, feature count and quality of features are not relevent to language utility, inferiority, or superiority. Thus the red/green coloring is misleading and at times innaccurate.
 
Finally, the code samples are also misleading. All the code samples as displayed have a greater line count for Java than the 'equivelent' C# implying Java is more verbose. In the article this is true for multiple reasons. The algorithms are different. In the Input/output section the Java example uses buffered IO while the C# sample does not. The Java implementation uses a superfluous File object constructor on both input and output which is not necessary (Constuctors for FileReader and FileWriter exist with a String argument for a file path like C#). Also to make the IO buffered in the C# example would need a call to a BufferedReader and BufferedWriter constructor to bring the number of constructor calls between the two samples equal.
 
Similarly, the "Pass by Reference" uses style to increase the line count Java sample. First: The swap method adds a line of whitespace after the temporary variable initialization. Second: A three line comment is added above the main method in the Java example. Third: the output line at the end of the main method is split into two lines in the Java example while being syntactically identical. Finally, even more damning the example is chosen to show the differences in C# and Java while casting the Java in a bad light because it "still" has not changed the value of s. Another equally simple example can be chosen where C# does not produce the results expected.
 
These are just two of the examples of how code that is contended to be "equal" is used to show disadvantages in Java. There are more.
 
This page should be scrapped and not rewriten for the reasons stated at the top. If not scrapped is should be rewritten to remove biases noted above.
 
One last note, I make my living writing C# code.
 
The views expressed in this article are solely the views of the author and not the owner of this IP address.
 
:Seconded - this entire article is clearly VERY biased. [[User:EboMike|EboMike]] ([[User talk:EboMike|talk]]) 20:53, 2 March 2013 (UTC)
::Thirded... While something like this could be useful (and it actually did answer a question I was looking up), it is in no way encyclopedic in nature. Something like this belongs on a tech advice site like stackoverflow, not wikipedia. [[User:Potatman|Potatman]] ([[User talk:Potatman|talk]]) 16:50, 15 March 2013 (UTC)
:::Fourthed. It's an unbalanced article, and it appears to be not consistent about trying to compare contemporaneous language specifications, a clear indication of poor research. (It doesn't belong on StackOverflow though; it would be ''rapidly'' closed as flamebait.) It's a shame, as a balanced comparison would be a genuinely useful thing, but I get the impression that most people preferring one or the other regard the trade-offs they are making as reasonable (assuming they don't go for outright language partisan fanboyism foolishness). Unfortunately, the proportion of ''academic'' — i.e., properly peer reviewed — references used is very small; having more independent voices describing the differences would be helpful here because of the languages' shared history. Or the core language designers from either side; I doubt they'd indulge in the sort of poor scholarship displayed here. [[Special:Contributions/82.42.214.208|82.42.214.208]] ([[User talk:82.42.214.208|talk]]) 01:04, 3 October 2013 (UTC)
 
I found it very informative though, and filled with useful information <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/132.183.102.105|132.183.102.105]] ([[User talk:132.183.102.105|talk]]) 23:43, 12 March 2013 (UTC)</span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
:Sure, it may have information in it, but that doesn't change the fact that it is not suitable for Wikipedia in its current form. [[User:EboMike|EboMike]] ([[User talk:EboMike|talk]]) 02:04, 22 March 2013 (UTC)
 
 
'''Page is very useful''' - An encylopedia at best is a source of useful knowledge, this page contains a great deal of useful information.
In response to arguments that this is irrelevant:
 
*These are two proprietary products produced by competing corporations.
 
Ignoring how C# and Java are open standards, why would this matter? If there was an article on advertising strategies of Coca-Cola and Pepsi it would still be interesting and useful.
 
*Many of the details are volitile (sic) and the article will quickly go stale.
That what we know changes is not a reason to never teach. What is the current status of hormone replacement therapy? How about dietary recommendations of sodium levels?
 
*Other issues related to colors and verbosity
Someone cleaned these up "try {" in Java versus "try\n\t{" in C#. Variable usage of white space is irrelevant, the reader will know that, ditto with colors.
 
*Bias
If information is incorrect or presented in a poor fashion, it should be removed. This is an entirely separate issue.
Why in the "Pass by reference" only immutable and basic types are used? String in Java is well known to be immutable while StringBuffer is the corresponding mutable class, in this case it seems that in java all the values are passed by reference. [[Special:Contributions/194.127.8.25|194.127.8.25]] ([[User talk:194.127.8.25|talk]]) 13:31, 4 October 2013 (UTC)[[User:Marco|Marco]] ([[User talk:Marco|talk]]) 15:04, 4 October 2013 (UTC)
 
*Not Encyclopedic
Admittedly, Britannica probably would not have this article. Britannica is also not as good as wikipedia. This article is a compendium recommending a lot of good information. People need to get things done with computers, C/Java/Python/C++/C#/Haskell are all ways to get stuff done, how do they compare? Many people have found this article useful. <small><span class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[User:Evolvedmicrobe|Evolvedmicrobe]] ([[User talk:Evolvedmicrobe|talk]] • [[Special:Contributions/Evolvedmicrobe|contribs]]) 21:42, 24 May 2013 (UTC)</span></small><!-- Template:Unsigned --> <!--Autosigned by SineBot-->
 
:Err... Java is an open standard. [[Special:Contributions/68.173.113.106|68.173.113.106]] ([[User talk:68.173.113.106|talk]]) 21:01, 21 July 2013 (UTC) (woops, sorry! I thought it was but the oracle google lawsuit made me wonder.
::I agree there really is no point to having articles like this at all. This is something that makes sense for a Gartner or Forrester report but not an encyclopedia. [[User:MadScientistX11|MadScientistX11]] ([[User talk:MadScientistX11|talk]]) 21:02, 17 December 2013 (UTC)
 
== Reference Type - Delete Phantom Reference Discussion? ==
 
I think there is a section that needs to be deleted, but am worried I have missed something so wanted to ask for comments before doing so.
 
The section on reference types contains this sentence:
 
" Soft references are much like weak references, but the JVM will not deallocate softly-referenced objects until the memory is actually needed."
 
But the cardinal rule of garbage collection (at least as I understand R/C#/Java) is that memory is only de-allocated/garbage-collected when memory is needed, never before. As such, I don't understand the distinction from a weak reference, and think the table should be condensed.
 
Anyone object (or see the error?)
 
Cheers,
N [[User:Evolvedmicrobe|Evolvedmicrobe]] ([[User talk:Evolvedmicrobe|talk]]) 04:28, 1 November 2013 (UTC)
 
== Language history and evolution -outright bias ==
 
== Modules ==
This section is terrible, and terribly unencylopedic. Java comes off as the George Orwell "Animal Farm" of computing, while C# sounds like the tyrant with operational efficiency. I think framing the historical perspective is very important, but it comes off so biased I think deleting it entirely would add to the article. An alternative would be to cut any post-2000 (the debut of C#) reference from the article. Would anyone be opposed to this? [[User:Evolvedmicrobe|Evolvedmicrobe]] ([[User talk:Evolvedmicrobe|talk]]) 04:40, 1 November 2013 (UTC)
 
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)
:I'm a little tired of seeing accusations of 'bias' here; as far as I can see, the Java section is just sloppy, and the claims made there can be substantiated with references or deleted. However it would be good to avoid creating complete version histories of both and refer to [[Java version history]], [[Java (software_platform)#History]], [[C Sharp (programming_language)#History]], and [[.NET Framework version history]] for details instead. [[User:Rp|Rp]] ([[User talk:Rp|talk]]) 10:16, 1 November 2013 (UTC)
 
== Type inference / manifested ==
Agreed! [[Special:Contributions/132.183.101.106|132.183.101.106]] ([[User talk:132.183.101.106|talk]]) 22:04, 1 November 2013 (UTC)
 
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]])
== Arbitrary size decimals ==
 
== Comparing Stream API and LINQ ==
C# offers [http://msdn.microsoft.com/en-us/library/system.numerics.biginteger.aspx BigInteger] that fits the description. Consider changing "no" to "yes" <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/176.195.178.252|176.195.178.252]] ([[User talk:176.195.178.252|talk]]) 04:15, 3 May 2014 (UTC)</span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
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-->
:C# already has a "yes" for arbitrary size integers (which is BigInt). Java has both arbitrary integers and arbitrary size decimal numbers. Do you feel this should be clarified? [[User:Useerup|Useerup]] ([[User talk:Useerup|talk]]) 13:14, 3 May 2014 (UTC)