Talk:Comparison of C Sharp and Java
![]() | Java Start‑class Low‑importance | |||||||||
|
![]() | To start a peer review, choose an appropriate topic from the list below and click on the link to create the review page.
|
![]() | Links from this article with broken #section links : You can remove this template after fixing the problems | FAQ | Report a problem |
This page has archives. Sections older than 90 days may be auto-archived by Lowercase sigmabot III if there are more than 4. |
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)
- 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)
- 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)
- 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)
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)
- 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)
- 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)
- 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)
- 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)
- 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)
- 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)
Speed/performance comparison
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_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? Useerup (talk) 11:29, 2 December 2012 (UTC)