Csharp Vs Java

For an articulate, blow-by-blow comparison of the two, see http://www.soften.ktu.lt/~mockus/gmcsharp/csharp/c-sharp-vs-java.html (but note, this article is dated 2001 and is substantially out of date).


CsharpLanguage and JavaLanguage:

C# structs are dangerously and cryptically implemented: See CsharpQuestions (search on word 'struct')


Summary:


For the record, the snide remarks above are by me. Don't mean to be too rude, I just really have a hard time seeing the alleged improvements from JavaLanguage to CeeSharp. To me, as a Java programmer, C# has exactly two things that I envy: close integration with the MicrosoftWindowsApi, and structs that can be allocated on the stack. So much of what I see is 'save four keystrokes' (isn't that what editor macros are for?). And so many of the alleged improvements to the VirtualMachine, pardon me, CommonLanguageRuntime, seem like old hat. Multiple languages in one program? Woohoo! I'm not going to take the stance that this is a management nightmare; if properly managed, it's wonderful. But I've had reasonably large Java runtime programs written in a combination of SchemeLanguage, JavaLanguage, and PythonLanguage, and never had any problems... and never really longed for any other languages, except PerlLanguage. I want to be converted, if for no other reason than I want something new to play with... but I just can't get CeeSharp or DotNet to excite me. -- AdamBerger

CeeSharp has more features than JavaLanguage, and is therefore more complex. You'll not see these features from a high level. What about CLR (CommonLanguageRuntime) attributes for instance? Do you really understand what they are about?

Nope, I'm not sure I fully do. Can you elaborate more? My (limited) understanding is that the CLR's 'big feature' is that it allows interaction of multiple languages (hence the CL), allowing things like classes in one language extending and using those in another. This isn't a property unique to the CommonLanguageRuntime, though. You see it anywhere a single bytecode is expressing more than one language... my example above was the JavaVirtualMachine. Are there other things I'm missing?

Sometimes 'save four keystrokes' is very important, not because it makes code easier to write, but because it makes code easier to read. In JavaLanguage, pulling an Integer out of a List ends up looking way too complicated when you read the code that does it. BoxingConversions would help a lot with this. -- ChristianTaubman

SyntacticSugar is one of the things that make the two languages interesting. I'm more comfortable with JavaLanguage, but I like how CeeSharp is more "Principles Atheist." Java polices you a little by not providing functionality that could be considered bad coding practice to use. C# gives you the right to do those things (GoTo, OperatorOverloading), encouraging you not to shoot yourself in the foot, but letting you govern yourself, so to speak, as far as what is "good" programming and what is "messy" programming.


Well, you get Perl RegularExpressions.

Indeed. In JavaLanguage, you need a separate package for this (the best I know of is Jakarta ORO). I also envy CeeSharp developers the built-in API for bytecode modification, whose closest approximation in Java is IBM AlphaWorks?' JikesCompiler Bytecode Toolkit.

Perl RegularExpressions are in JDK 1.4 in java.util.regexp


And does anyone but me want to call it C Hash?

I prefer to call if D-flat.

Here's another vote for C Hash.

"C-pound."

I think they should spell it with a Unicode sharp sign -- as opposed to a plain hash -- if they insist on calling it that.

"C Octothorpe"

Is the sharp(#) overlapped plus-plus(++)?

InTheory.


I think this whole page misses the point. MicroSoft isn't pushing DotNet as a better way because CsharpLanguage is significantly better than JavaLanguage. It's because they claim the .Net environment (CeeSharp and the other languages, VirtualMachine, runtime libraries, etc.) is better than the Java environment. CsharpLanguage is not obviously much worse than JavaLanguage. That's all MS needs from it.

To some extent, I think this may be the most insightful comment on the page. On the other hand, the page is'' CsharpVsJava, so we have to find some way to compare them. As to 'not being worse' being good enough... well, from a marketing point of view, I'll accept that. But from a developer's point of view, it's kind of a disturbing attitude.

And, moreover, I'm not at all convinced DotNet's environment is that revolutionary. (Is there already a page like DotNetVsJava?, or shall we move some of this over there? [Well, we do have DotNetWillKillJava, EjbVsDotNetNews, JavaAndDotNetPhilosophies.]) It seems like much of .Net's astounding new capabilities are things I've been doing, on a daily basis, in Java. And the Java APIs, while a few things are missing from the core (like RegularExpressions, mentioned above [RegExps are in fact in the core, as mentioned above]), do have the advantage of a lot more maturity... and today, if not tomorrow, much more third-party support.''

I agree most of what can be done in DotNet can be done in Java. But not out of the box; there's a certain amount of installation and systems integration needed to get things working in Java (that's the downside of the "much more third-party support"). MicroSoft has also taken the opportunity to do a lot with areas of .Net that aren't anything much to do with language or standard libraries: a very neat cache (heavily used in AspDotNet), assemblies (so easing version problems), etc, etc. Nothing innovative in the individual items, but the whole is, IMO, and the evolution is controlled by one company, making uniformity much easier to achieve (which is good and bad, of course). For instance, you're pretty much required to use VisualStudioDotNet. Good: all add-on developers have one platform to aim at. Bad: other IntegratedDevelopmentEnvironment vendors have huge barriers to entry. You are not required to use VisualStudio (not even close)!.

pretty much required to use VisualStudioDotNet. You are? In what way?

Actually, the luscious support for CeeSharp provided by VisualStudioDotNet is a distinguishing virtue all on its own.

I might have been wrong. It seems it's not strictly true (it seems that the SDK is enough to support a compiler, etc.), but there're a lot of integration and DotNet-specific tools in VisualStudioDotNet which would be difficult to compete with, so I think the barriers-to-entry-point still stands.

There's an OpenSource IntegratedDevelopmentEnvironment for CeeSharp which is completely written in C#: http://www.icsharpcode.net/OpenSource/SD/Default.aspx

Well, I'm not a fan of IDEs so there may be some bias, but I certainly don't feel that I'm missing out by not using VisualStudioDotNet. I also can't think of anything in VS.Net that other vendors wouldn't be able to compete with. Anyway, this is about CeeSharp/JavaLanguage, not VS.Net/Java. For what it's worth, I think the language debate is largely pointless, painfully emotive, and almost always carried forth by programmers who have very little experience of the other language.

"You don't need [VAR parameters] in an object-oriented program." If I have to interpret this then I had to paraphrase it with "VAR parameters aren't required to write object-oriented programs." I find this a very unenlightened view - higher level languages aren't necessary to write programs; we could still manipulate bits and bytes directly. Why the change then? Because higher level languages make things easier for programmers. And if VAR parameters make things easier in C#, then why don't use them in such cases?


PageAnchor: generalization

Well, as a JavaLanguage programmer I've been forced to work with AspDotNet / CeeSharp. I liked it. As Java is built on the memory of CeePlusPlus errors, so C# used the experience with Java for improvements. Indeed, not all are good (about 68% are good). ASP.NET has a very similar ObjectModel for building a DeskTop application. I find it very helpful.

We should also remember that it is not CsharpLanguage vs. JavaLanguage, but DotNet vs. IbmCorporation vs. Oracle vs. Bea and friends.

One BIG problem with JavaLanguage/JavaTwoEnterpriseEdition is over-generalization. Generalization is basically good when it is essential and minimal. Remember that OO code reuse has not reached the highest expectations. (failed for business logic, if you ask me). Too many choices killed CeePlusPlus. (The reports of C++'s death are greatly exaggerated.) Let's not make the same mistake with Java. Why does Java need two user interfaces frameworks? I don't like all this Java-naming scheme. Make java.swt (my hope) -> java.ui, make javax.jms -> java.messaging. I prefer uniting all JAXP JAXB JAXS JAXX into java.xml and make one SIMPLE standard. See how well it is done in DotNet.

I prefer the Unix model of having a ton of small programs (analogy to the small APIs you mention) that do exactly what they're supposed to do very well, and nothing more. You take those small pieces of functionality and combine them and you get something extremely powerful. Yes if you want to do a specific task, you need to comprehend the technology you need to use. Throwing separate APIs under a common namespace only hinders this.


CsharpLanguage is better at managing memory. We're developing statistical applications for analysis of MicroArray? and MassSpec? data (that's genes and proteins). When a single dataset has 1000 columns and 50000 rows (all doubles), memory means a lot. Then, you generate even more data as part of the analysis. We compared JavaLanguage to CsharpLanguage and found that Csharp used less memory.


Discussion moved to CsharpLanguage.


See CsharpLanguage, CsharpFeatures, CsharpLanguageDiscussion, HolyWar


CategoryJava CategoryCeeSharp CategoryComparisons CategoryProgrammingLanguageComparisons


EditText of this page (last edited August 14, 2013) or FindPage with title or text search