Six Java features C# developers will kill for...


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:

  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.
  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...
  3. 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).
  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.
  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.
  6. 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.

Up Next
    Ebook Download
    View all
    Learn
    View all