I have just finished watching the interested InfoQ talk called “To Java SE 8, and Beyond!” where Simon Ritter discusses the future of Java, taking a look at proposed features and roadmap for Java 8 thought 12.
It is absolutely clear that many of the new proposed features has been taken from C# and in this post I would like to show some comparisons.
First of all, it is important to say that the information presented in the talk are only a draft and here I would like to report the statement presented in the Oracle slides associated with the talk.
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not berelied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
LINQ is by far my favourite feature of the C# language and Java is likely to add extension methods and lambdas to the language included the possibility to create a parallel execution.
This is something that has been introduced in C# 3.0 in 2007 and you can notice the similarities.
In C# is also possible to write the same statement using the query syntax:
The various methods are actually implemented as extension methods of the IEnumerable<T> interface.
An another idea is to simplify the references between java modules, something that we always had for the .NET assemblies.
It is interesting that for the version 9 of Java SE (in 2015 according to the roadmap) there is a plan to support multi-languages in the JVM. This is actually something that is a core design principle of .NET that allow to run VB.NET, C# and many other languages on top of the platform. In addition, this will require the definition of a unified type system in Java that in .NET is called Common Type System (CTS).
In Java 7 has been introduced the invokedynamic bytecode instruction to improve the support for not-Java languages. I don’t know how to use it but it seems that there is no an easy way to use this feature at the language level. There is no comparison with the simple and effective dynamic keyword introduced by C# 4.
If this is not enough, in the JDK 10+ (2017) the unified type system will be introduced and primitives types will be removed. This basically means that Java is going to introduce value types (structs) in the picture. In .NET all of this was taken into account from the very beginning. I am quite impressed how well .NET has been designed. You shouldn’t forget that this happened more then 10 years ago !!!
Also multi-dimensional arrays will be introduced in Java in the JDK 10+. Again in C# we have the multidimensional arrays for such a long time.
There are some features that has been vaguely announced that are very interesting:
- Improve Java/Native integration and sensors support
- Cloud support (multi-tenancy and resource management)
- Sale down to embedded, up to massive servers
- Hypervisor aware JVM
- Large arrays
- True generics
- Performance improvements to close the gap to low-level languages
I am very happy to see that the Java language is evolving. Anyway, I continue to be a big fan of C# and the .NET platform where the designer of the language, Anders Hejlsberg, is putting a lot of innovation in it with the main mission to improve the productivity of developers.