courses

05.03.12

Ultimate Java

3 days

 

 

Articles

31.05.11

Quality issues? try defect prevention

Avi Nehama

 Traditionally, software organizations focus on uncovering the defects in the code...

 

11.05.09

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

Ran Kornfeld

C# is called Java on steroids, and everyone agrees that...

 

Articles

Java Dev Day Presentations

You can find all Java Dev Day presentation using Papercite. Click to get it!

Training Materials

Get free access to high quality training materials

 

Articles & referrals


Ran Kornfeld

May 11, 2009

Not everything on the .NET framework is perfect, and Microsoft still has more improvements to implement. This time we will look at six features available to Java developers but unfortunately absent from C#.

In the last article, I gave six features that are available in C# but not in Java and can make Java developers jealous of their C# friends. I 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 Netbeans) 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 2008 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. 
 

Back