Matt Davey just posted about a presentation to management types where they asked the question (among others)
“What major advantage does the C# language have over and above the Java language?“
My first thought was “attributes“ which allow developers to tag code with metadata that can be programmed against but I was sure there was more. Since I’m not a C# guru I did a quick web search and found a great essay entitled "A comparison of Microsoft’s C# Programming Language to Sun Microsystem’s Java Programming Language" by Dare Obasanjo.
Dare listed the following things C# has that Java does not:
- Deterministic Object Cleanup
- Delegates
- Enumerations
- Value Types (Structs)
- Boxing
- Run Time Type Identification (as operator)
- foreach Statement
- Properties
- Multidimensional Arrays
- Attributes
- Indexers
- Preprocessor Directives
- Aliases
- Runtime Code Generation
- Pointers and Unsafe Code
- Pass by Reference
- Variable Length Parameter Lists
- Verbatim Strings
- Overflow Detection
- Explicit Interface Implementation
That’s a lot! Though that list is great, it was written as a list for developers, not managers. The question then would be, which of these differences could actually translate into a benefit a manager could appreciate?
I’ll take a stab at this, but would love comments from others on how to best present C# as having values business people can appreciate. I can’t find a direct business benefit for some of these features:
- Without Deterministic Object Cleanup Java apps could create unacceptable performance bottlenecks after deployment, which could cost a lot of time and money to fix.
- Delegates allows a more flexible implementation of callbacks, which reduces the complexity of code and reduces the likelyhood of logic errors.
- Enumerations increase robustness by providing type checking and reduces “copy&paste“ errors because enumerations can be converted to their string equivalent. Java developers will need to spend more time testing and debugging.
- Properties allow more natural syntax. If Java programmers “get lazy“, write directly to fields, and later need to trigger code on a field assignment, they have to modify a lot of client code. If they get lazy in .NET, they can just change the field to a property w/o affecting client code. However it does take a recompile (I’ve always hated that about .NET)
- Attributes allow developers to embed metadata and program against that metadata. This increases the power and flexibility available to a software architect designing an application framework. .NET modules are discoverable which greatly reduces the need to distribute related information across multiple source files. This reduces potential errors and hence testing and development time as well as increases reliability and robustness. In my mind this is probably one of the strongest benefits of using C# over Java.
- Runtime Code Generation allows an application to implement its own extensions based on user imput. Most developers will never attempt this, but when it is useful there really isn’t an alternative.
- Overflow Detection increases robustness and reliabiliy because potentially critical errors that might go unnoticed in Java will be caught by the .NET runtime.
- Explicit Interface Implementation can offer significant cost savings when naming conflict occur during code integration, especially if those conflicts are in 3rd party components.
That’s my list. BTW, I think VB.NET offers all the same benefits. Do you have more?
i want to know the platform on which c# operates .and its relationship to database and networking.
c# operates on windows platform, it has the capabilities to work with all the major RDBMS, like oracle, MS SQL, and many others
You can run/write c# cross platform apps by using mono
http://mono-project.com/Main_Page
By using mono with either gtk# or winforms or (moonlight) linux version of silverlight you will have a cross platform c# program.
are you sure that java doesnt have enumations? realy? you must be joking
@codester – Dude, care to notice what year this post was written in?
what is core(fundamental) advantage of c#?
a.class
b.inheritance.
c.abstraction
d.none of the above
@sivaraj,
Did you not both to notice this post was written in 2004 (9 years ago) before you decided to comment?