In the last article from June 21, I gave six features that are available in C# but not in Java and can make Java developers jealous of their C# friends. I got responses from readers about the article, and decided that I must also show the other side of things.
So, being a long time Java developer I will show some loyalty to the (great) Java language and present six features that we have in Java, and we wish we had in C#.
Here they are:
-
Stronger enums - In C# enums are just constants with an integer value. Oh yes, you can also use other integral types (byte, long, etc.). In Java enums can have constructors, methods, implemented interfaces and abstraction. This gives the enum feature great flexibility and allows the programmer to create smarter and more powerful enum uses.
-
Checked exceptions - Only after you taste them, you understand the power of checked exceptions. We are basically lazy creatures and when something is not required, we just might not do it. So exceptions are thrown all over but no one knows (unless you love reading the small letters in the MSDN documentation). Try-catch? Naaa, it won't happen to me...
-
SDK sources - Where the hell is the .NET SDK sources? It might sound like a strange wish but being a Java programmer I am used to browsing the SDK sources, looking for examples and learning from the implementations. I found it very helpful and it sometimes can even help in resolving strange behaviors encountered. A penny for someone who can tell me how the .NET ArrayList class is implemented internally ("using an array" is not an answer).
-
Smarter IDEs - I must tell you that before I started using Visual studio I thought it is the best IDE available. This was probably true 3-4 years ago. But today, Java IDEs (mainly eclipse and IntelliJ) are so smart, they make the programmer look dumb. These IDEs can do everything except coffee, although I am not sure about the planned features. It almost seems they write the code for you. Visual studio has a long way to go, even the 2005 edition.
-
Open source free projects - I love free stuff. Everyone loves free stuff. Java developers love free stuff, and will probably find free stuff they can use in their own projects. Hundreds of free, open source, production level Java frameworks, tools and components. C# developers will pay.
-
The Apache Software Foundation - This organization is responsible for the success of 80% of Java related projects. You can always trust their Java projects to save you when you come across some nasty requirement.
I guess there is no perfect language. Each one has its own stronger features, and things we wish it had. What's left is for you to decide, and I know it might be harder than it looks.

Bryan LatimorePosted Dec 31, 2010, 10:55 AM
I have been a java and .NET developer / Architect for almost 10 years. I use Eclispe, NetBeans, Intellij and Visual Studio all day everyday. Trust me Visual Studio is in a class of its own. Those others cannot hold a candle to Visual Studio. I like java and .NET but Visual Studio is far better. No question about it.
pabloPosted May 14, 2007, 7:10 AM
mike - did you ever used eclipse that you are blaming the author that he is kidding you ??? Im using Eclipse and VS 2005 every day because Im Java and C# programmer. Eclipse for several years, VS for ~1year, maybee more, so I think I can say something about it without ridiculous flames - I have to agree with author of this article, Eclipse is much better IDE and VS can learn very much from it although there are some things VS can do better (for example autocomplete is smarter in VS)... Eclipse is unbelievable piece of software and it's pleasure to work with it.. Without Resharper from JetBrains it would be pain for me to work with VS because even with Resharper installed, Eclipse is much better in refactoring and further things and details that make programmers life much easier... also what Im missing in VS is some free subversion plugin which can be compared to great Eclipse plugins like Subversive and Subclipse... because I think ankhsvn for VS is inactive piece of crap... Im not saying VS is bad, it's great IDE but Eclipse is much better... believe me or not, I dont mind, because Im using both every day :)
Dipen LamaeditedPosted Jul 11, 2006, 4:13 AMEdited Jul 12, 2006, 3:59 AM
I have not seen IDE better than Visual Studio 2005. IntelliJ though smarter is very very slow. Visual Studio 2005 intellisense work not only with .NET language but also with html, css and JavaScript
Mike GoldPosted Jul 10, 2006, 10:42 PM
1. Stronger Enums - In C# enums are just constants with an integer value. Oh yes, you can also use other integral types (byte, long, etc.). In Java enums can have constructors, methods, implemented interfaces and abstraction. This gives the enum feature great flexibility and allows the programmer to create smarter and more powerful enum uses. Why would you want to have methods for an enum? An enum is just a list of related constants. What you describe as an enum is a completely coupled definition of something that was never meant to have methods. Oh yeah, there is such a language structure in C#, it's called a class. 2. Checked Exceptions -Only after you taste them, you understand the power of checked exceptions. We are basically lazy creatures and when something is not required, we just might not do it. So exceptions are thrown all over but no one knows (unless you love reading the small letters in the MSDN documentation). Try-catch? Naaa, it won't happen to me... I'm not highly familiar with Checked Exceptions but here is a quote from Don Schwartz, who has a blog on Java: "Compile-time checking of exceptions is a useful language feature, but often this feature can become a nuisance. This is particularly true when checked exceptions are used (in my opinion) inappropriately, for example to signify an unavailable resource or a coding error. " Also a quote from Anders Hejlsberg: "By implementing checked exceptions the way it's done in Java, for example, I think you just take one set of problems and trade them for another set of problems. In the end it's not clear to me that you actually make life any easier. You just make it different" From WikiPedia "some see checked exceptions as a nuisance, syntactic salt that either requires large throws declarations, often revealing implementation details and reducing encapsulation, or encourages the (ab)use of poorly-considered try/catch blocks that can potentially hide legitimate exceptions from their appropriate handlers." 3. Where the hell is the .NET SDK sources? It might sound like a strange wish but being a Java programmer I am used to browsing the SDK sources, looking for examples and learning from the implementations. I found it very helpful and it sometimes can even help in resolving strange behaviors encountered. A penny for someone who can tell me how the .NET ArrayList class is implemented internally ("using an array" is not an answer). Which class did you ask about? The ArrayList? Here is the source for the Add method. You have access to all of the source to the .NET SDK framework if you know where to look. Simply use reflection: Here is the source for the Add method for example: public virtual int Add(object value) { if (this._size == this._items.Length) { this.EnsureCapacity(this._size + 1); } this._items[this._size] = value; this._version++; return this._size++; } 4. Smarter IDEs - I must tell you that before I started using Visual studio I thought it is the best IDE available. This was probably true 3-4 years ago. But today, Java IDEs (mainly eclipse and IntelliJ) are so smart, they make the programmer look dumb. These IDEs can do everything except coffee, although I am not sure about the planned features. It almost seems they write the code for you. Visual studio has a long way to go, even the 2005 edition. You have got to be kidding me. What version of Visual Studio are you using, the beta? I've used Eclipse, it doesn't hold a candle to the Visual Studio environment. And have you ever used Jet Brains or similar applications that expand Visual Studio capabilities? 5. Open source free projects - I love free stuff. Everyone loves free stuff. Java developers love free stuff, and will probably find free stuff they can use in their own projects. Hundreds of free, open source, production level Java frameworks, tools and components. C# developers will pay. Clearly you just started using .NET and don't have any idea as to the tremendous amount of open source tools and code available for the .NET environment. What about tools such as NANT, NUnit, Cruise Control. What about the horde of free components and code out there? What about this site , GotDotNet and Code Project? And that is only a fraction of the code and utilities available for .NET for FREE!! 6. The Apache Software Foundation ...- Who? Never heard of this foundation, but just go to SourceForge and see the host of Open Source .NET applications. And why doesn't the Apache Software Foundation Support .NET Open Source Applications. If they were truly open source, then they would have no language prejudices.
Mahesh ChandeditedPosted Jul 6, 2006, 6:39 AMEdited Jul 6, 2006, 7:06 AM
Ran, I have to disagree with #3 and #4. Visual Studio 2005 documentation is the best help now and Visual Studio 2005 has to be the best IDE. No body can beat that ;) Cheers! Keep up the good work.