Talk:Comparison of C Sharp and Java

This is an old revision of this page, as edited by 69.18.50.2 (talk) at 10:07, 2 December 2012 (Speed/performance comparison: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Latest comment: 12 years ago by 69.18.50.2 in topic Speed/performance comparison
WikiProject iconJava Start‑class Low‑importance
WikiProject iconThis article is within the scope of WikiProject Java, a collaborative effort to improve the coverage of Java on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-importance on the project's importance scale.

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. 193.165.212.242 (talk) 11:54, 14 November 2011 (UTC) (cs:User:Pteryx)Reply

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. 86.26.141.146 (talk) 17:31, 1 January 2012 (UTC)Reply

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. Rp (talk) 18:05, 3 January 2012 (UTC)Reply
Article.isBiased() == false; 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, The Doctahedron, 00:42, 24 January 2012 (UTC)Reply
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. 90.194.203.69 (talk) 12:39, 16 February 2012 (UTC)Reply
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#. — Preceding unsigned comment added by 152.23.122.74 (talk) 20:59, 2 May 2012 (UTC)Reply
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. Sae1962 (talk) 10:25, 3 September 2012 (UTC)Reply

I think that the article is no more biased. I plead to remove the marking that it is biased. Sae1962 (talk) 15:06, 12 September 2012 (UTC)Reply

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. Useerup (talk) 19:19, 12 September 2012 (UTC)Reply

Contradiction

In section 1.1 Features, it says that Java has a Decimal128 data type:

Data types Java C#
IEEE 754 binary32 floating point number Yes Yes
IEEE 754 binary64 floating point number Yes Yes
High precision floating point number 128-bit (28 digits) Decimal type 128-bit (28 digits) Decimal type

The simple answer, as stated in section 1.3.2 Primitive types is NO. Don't worry, I already fixed it. 68.173.113.106 (talk) 03:29, 2 March 2012 (UTC)Reply

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. — Preceding unsigned comment added by 94.174.207.151 (talk) 06:09, 6 September 2012 (UTC)Reply
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. Useerup (talk) 08:22, 13 September 2012 (UTC)Reply

Please PR this page

Please Peer Review this page. Thanks! 68.173.113.106 (talk) 01:13, 10 March 2012 (UTC)Reply

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. Useerup (talk) 08:20, 13 September 2012 (UTC)Reply


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 ---

Both languages do not directly allow arithmetical operations on all primitive types, as they arbitrarily default to int or double:

Java C#
    byte value = 2;
    float price = 5;

    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; // <<<
    byte value = 2;
    float price = 5;

    price++;
    value++;
    // Error: conversion from int to byte
    value = value + 4; // <<<
    value += 5;
    // Error: conversion from double to float
    price = 5.7; // <<<

--- end section ---

Platform Support

The table regarding platform support states "Yes" in the C# column for Linux, Mac OS X, and Android. We all know that Microsoft who created and continue to create the C# language have not officially made the .NET runtime work on any of those, but rather it is an open source project named "Mono". At present there is merely a reference to the Mono project page, but I propose actually specifying that it is a third-party implementation, thus not one offered by Microsoft. Hence, I propose that for those platforms it should state: "Yes, but third-party". I already made this change already, but it was reverted because it supposedly doesn't make sense since Java support is third-party. This is absurd. The Java referred to in the article and in Wikipedia in general is that distributed by Oracle, and for C# it is that which is distributed by Microsoft.

Can you please leave your favouritism towards C# alone and please just provide useful information for readers. I am sure it is in the interests of the readers to know that C# does not run on those operating systems without additional third-pary software. Kupraios (talk) 04:09, 26 November 2012 (UTC)Reply

Is Java on Android supplied/supported by Oracle? No! Oracle actually sued over that. I am sure it is in the interests of the readers to know that Java does not run on that operating system without additional (and controversial) third-party (Google Dalvik) software. See how that argument can be used against Java as well?. I ask just that you use the same standard and don't use loaded phrases ("but" is a loaded word implying a reservation - your personal reservation, not a reservation that should be put forward in the voice of WP). Please also keep in mind that these are the programming languages and not the platforms (Java and .NET). The "platform support" section is already a stretch in that regard, but if it has to mean anything in an article about the programming languages it must be that you can use the language to code for the platform. That's why Android has a "yes". Just use the same standard for C#. If you believe that the way through which a platform is supported is important then put it in a note - like {{yes}}<ref>through Mono</ref> and {{yes}}<ref>through Dalvik</ref> - or something to that effect (with links). That way WP does not make judgement calls but allows the reader to come to his/her own conclusions. Useerup (talk) 11:57, 26 November 2012 (UTC)Reply
Then change the column value for Android support on Java. I don't oppose doing so whatsoever, I just am not aware of Java support on Android. You seem to assume that I am pro-Java and am attempting to attack C#, but I actually prefer to use C# over Java, so your argument is unfounded. If the word "but" bothers you then "using" may be used, thus it may read: "Yes, using third-party software". You seem to be offended at the fact that these languages require third-party software to run on other platforms and are attempting to hide this fact, but this information is useful to the reader and is very relevant to the topic of platform support. Kupraios (talk) 17:39, 26 November 2012 (UTC)Reply
WP:AGF. I reverted your edit and in the very summary I pointed out how it would be unbalanced to not use the same standard for Java. You were actually the one accusing me of favoritism towards C#, so let's not go there. And yes, I do have a problem with "but" because it is a value judgement. Some may even believe that it is a "good thing" that it's 3rd party support. Rather than saying "3rd party" why not just point out how in a ref? For the record, I do believe that the entire section is problematic because you can always find some way to use a programming language for a given platform through cross compilation. It is meaningless when comparing languages. It was put there by someone who mistook language for platform. I would prefer we just delete the section. Useerup (talk) 18:07, 26 November 2012 (UTC)Reply
I tried to work in the specific references. Is that better? I have reservations about the in-the-box link. I'm not convinced that you can actually run Java on a non-jailbroken iOS device. in-the-box does not seem to be a cross compiler, but rather a VM. Apple does *not* allow VMs on iOS devices. Also, there's a blog post ref in there. Useerup (talk) 18:22, 26 November 2012 (UTC)Reply
I'd argue to keep it in because although it is true that the programming language itself is separate to the platform with which it runs on, this information conforms to what people would expect to find in this article. We have to find a balance between political correctness and usefulness. People reading the article will infer that it is the native platform being referred to, otherwise they most likely don't understand the rest of the article. Also, what about running virtual machines on an OS? Should we take those into consideration too? I think not, it's best we just assume native support as a default. Otherwise the articles regarding software made to run on a specific OS could be argued as being able to run on all OSs even though that isn't exactly true.
The changes you've made are better in that it is clearer that there is no native support on those platforms, but I wouldn't put specifics (referring to Mono) the way you have. I would just refer to it as third-party and have a reference to Mono because otherwise it could suggest favouritism towards using Mono and not some other software that could exist (if it does). It suggests that Mono is an officially used platform for running C# rather than a community project. It's best to just be generic and have the reference be specific, hence: "Yes, using third-party software<ref>Mono</ref>". That way more references can be added in the future without disrupting the visual appeal of the table, and also it contains more information in a smaller space. Kupraios (talk) 21:12, 26 November 2012 (UTC)Reply

Speed/performance comparison

As I know, Microsoft bans benchmarking .NET Framework without their written permission: 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.69.18.50.2 (talk) 10:07, 2 December 2012 (UTC) cs_studentReply