I usually do a lot of introductionary java courses, and have to learn people everything from scratch over and over again. The course material I use has remained stable for many years, until the launch of java 5, when the language really started to move away from its core. It is clearly a response to pressure from other languages breathing down its neck such as C#, Ruby, Groovy and others.
Here's a list of things really changing core things in the language
Java 5
These all were introduced with Java 5
- Autoboxing - A solution to switch between primitives and objects. Implemented to get closer to "real" object-oriented languages. Yet it can be a rather unnatural thing
- Generics - Sacrifysing simplicity to gain stronger typing. The Type Inferense comes orthogonal to the current understanding with a new set of rules and syntaxes, and it is present in many standard APIs. So present that you can't really postpone exposure to it even in the beginning. However, ClassCastExceptions seems to have dropped some..
- Annotations - For the lack of foul words.. Where should meta-data exist. Granted it did clear up some of the incipient worries of XDoclet programming, but please remember there are two sets of meta data, one internal to the application to deal with during programming and installation, and one to deal with in production. Keep the production metadata external, please.
Java 5 also had a few other changes, but they can hardly be seen as any major change to the language itself.
I believe that Java 5 additions were mostly a compensation for features present in the uprising C# language, which was sweeping into the Java space.
At the same time people also experimented with another methodology/paradigm:
- Aspects - A radical shift in representing functionality as a cross-cutting consern, however it did exist in a Decorator pattern of I/O. A BufferedReader can also be seen as a simplistic crosscutting consern :-)
Java 6 and 7
It is easy to look through the changes in Java 6, however, with Dolphin on the design table a lot of new ideas is coming into play. Most of these inspired by other languages, who just "had it" or just " did it". However, they all can be seen as moving Java away from the core.
- Scripting support - The possibility to embed another language within the Java language. Seems rather natural in todays development where any developer usually have a palette of languages and formats to deal with.
- Property Literal/Property Object - An attempt to make reading and writing of properties into a transparent matter, like C#s property item. Well worth it since get and set methods were usually poorly used and their argumentation forgotten anyhow.
- null-safe types - Adding a type indicator which compiles to not-null making the type "safe" at runtime. Could help endless hours on tracking NullPointerExceptions
- null-safe invocation - Adding a more loose construct to avoid having checking delegated references.
- Closures - Using code blocks as a programming construct. Was introduced with the anonymous classes in a more cumbersome way, but now being pushed towards the front of the bar, and really splitting part of the community.
- operator overloading - This has been reserved by mostly java.lang.String for a long time, and now starting to lure again. It will expand the scope of cognition when reading source code. However, it is fundamentally no different than methods, such as 1.add(2).minus(3), and may be compiled into this.
Which of these actually make it into Java, I do not know (Except for the scripting support), but eventually time will tell.
My view
What do I have to say of this? Well, First of all I embrace changes. There are things in here that I have been wanting for years and things that I would rather avoid, if I could. However, all of these options are "forced by community/comittee/sun" on the language, and I cannot pick.
I have occasionally used Java Syntactic Extender as an advanced macro-expander, which has given me some of the features available (for/property/closures). I find this approach more select-to-your-liking, rather than enforcement. Kind of like a little-language extension to syntax,and quite beneficial for domain specific languages.
One thing I would hope be favoured more between the language developers is how to benefit from each other, such as how to naturally import and use a .net class in java, and running rails with true java integration. More focus on integration would be higher appreciated by me right now. Java Scripting support is really a feather in java's cup.
What do you think?
0 comments:
Post a Comment