With the risk of sounding like a language zealot, here’s my reasoning what went better with C# than with Java… Before I begin, let’s clear this out of the way – I can only assume that some of the reasons that follow are due to historical perspective and Microsoft learning from Sun’s mistakes.
First of all, after looking into a relatively large Java application (Azureus, a BitTorrent client) it is perfectly clear how much delegates and properties clean up the syntax in C# vs Java. There is a shit-load of thin interfaces and classes in Java that simply help implement event sources/listeners, where in C# we have delegates. There are so many get/set methods in Java that you can’t see real functionality. This mostly looked like a syntactic sugar to me (and to a certain extent it is) until I saw how much cleaner the code looks with and without it. Delegates in C# also have asynchronous support which is even better – instead of everyone making their own, we can all just use the built-in one.
Due to high number of interfaces everywhere, Java projects seem to be over-engineered more often than not (but I have seen C# projects with useless interfaces everywhere too). Mostly everything has an interface and an implementation – do we really have a need to reuse all of the classes??
C# libraries seem to favor consumer (developer) convenience over API purity, while with Java it’s all about canonical and minimalistic interface (see previous post).
There are other things that don’t work with Java (no ValueTypes, faking generics support instead of changing the VM in the latest incarnation) but I wanted to point out just a few that you’d normally never take issue with.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5