I was lucky like many others that start programming from about ten years, and touched many languages such as: Basic, Visual Basic, C++, C Sharp, Java, Python, Scheme, Go, and Erlang and others.
Usually there are trend in community to compare between Java and C Sharp or C++ and perform benchmark. But today I would like to take a look at the future of great programming language like Java from the today issues and problems.
Java first release was 14 years ago, now the community wait for version 7 (1.7). But I think we need to version 2.0. I think we need new start, fresh start without think too much about backward compatibility. This fresh start as I imagine it will eliminate a lot of the bad design decisions that we made over the last 14 years, also it will give us a opportunity to think outside the box to solve the design issues and challenges such as: Parallelism, Garbage Collection, and Optimize the language for the managed environment.
Also I as imagine this new start as opportunity to rethink about how we should design the VM in light of latest researches such as: XAX, Native Client, and many others.
But such decision is very hard to make, but if you watch closely, you will find that many companies had take it without loose the control. For example: Apple transition to Mac OS X, Python 3, VB to VB .NET, and others.
But the question are we really need this transition ? I think YES, If you looked closely you will find a lot of issue in the language and in the attached framework that can’t solved without break some of the backward compatibility. Also as I imagine this transition it will come with new performance level, parallelism in the language, fix a lot of issues, and new features. But as you know nothing for free, we should pay. For example Python community still maintain the old platform 2.x while they working in 3.x path, so any transition will take time.
While we speak about managed languages we should consider the performance overhead of our decisions. One of the issues with Java today is it’s not support Structure (Value Type) which mean every object you create is Reference Type that will live in the heap except the built-in primitive types (int, short, float, etc). Which means every object you create will create pressure/overhead on the garbage collector even the point object (X, Y). Also Java don’t support passing primitive by reference and you always will need to boxing and unboxing the values. Some people will will say theoretical it’s not legal to pass a reference of value type, but I disagree with this statement. Also boxing and unboxing the values will add unnecessary overhead on memory and the garbage collector, while it’s applicable feature and exist in other languages such as: C Sharp.
The language framework (Java Class Library, .NET Framework, STL, etc) still the source of major problems and criticisms. I was write before performance issues in .NET Framework. Java also have issues in design and performance, I will not count it here, but I will just give you one examples:
BufferedStream class have method called skip, this method should skip number of bytes that you pass. But this method only skip within the current buffer, so you will need to write another method let’s say called ‘SkipFully’ and call skip method in a loop and calculatethe skipped value that skip method return.
This is very bad and we usually miss it, however if you searched inside the Java Class Library you will found that this method is used a few times without considering the previous issue! bugs!
I think you can get more in Java Puzzlers.
— Haytham ElFadeel | Jan 2010