Java as a language is getting more complex with each version. From version 1.0 to 1.4 most of the complexity was added through libraries. Thousands or lines of code were added in hundreds of new classes. But this complexity was contained–if you didn’t need a feature you could ignore it completely. At worst, you might miss out on some new, neat feature. But starting with 1.5 the language itself changed (OK 1.4 added assertions but that’s a very small feature that can be readily ignored).
Version 1.5 added enums and Generics. Enums are a medium-sized change, mainly a way of listing enumeration values, but there are subtleties that make them complex (like conversion to/from integers, accessing all the defined values, etc.) Generics are a big change. The fact that all the collection classes were retrofitted to be genericized1 means that most new code will have to deal with them whether they want to or not. Trying to ignore them just results in streams of warnings.
Now with 1.7 or maybe 1.8 we are talking about adding closures and possibly continuations and properties. If you think that code with generics is hard to read then just wait for closures. The subtleties of where a braces goes to decide if a closure is being defined is guaranteed to create uncertainty and confusion.
My question is “are we adding too much complexity?” The thousands of lines written for the libraries before 1.5 are extremely useful and in fact are still used after 1.5 so generics, enums, and closures are not necessary for useful code. So why do we see the need to add this complexity?
When I started using Java I thought it was a nice simple language for writing web tools but that it wasn’t a “real” language for use in “real” work. But then I started using it for a real project and I realized that it might be a simple language, but it could do what I needed. Granted pre-1.2 things were a little coarse but by the time 1.2 came out things really started to smooth out. Then as I used it more I kept thinking “this is a boring language; it has no fun features.” Years later, as I have gotten older, I have begun to reconsider my evaluation. Yes, Java is a rather simple language, but that may be a good thing.
I like functional language as I think that function composition is a very powerful feature that results is smaller code bases. But when I look at what’s coming in future releases I start to worry. Here where I work we have developers of differing levels and I have seen them have problems with even the simple things in 1.4. Complex feature like Generics are going to make it hard to keep everyone up to the necessary level of competence.
Even though I was one of those clamoring for Generics I am now not so sure that they should have been added to the language. I consider myself a senior developer and while I am now comfortable, but not an expert, with using generics it is such a big change that I would say that Java 1.5 is actually a new language. As a senior developer I have no problem learning new languages and in fact I learn new ones for fun. But think of the junior and even mid-level developers. May of them are still trying to get a handle on the base language.
- I know this isn’t a real word yet, but it is becoming prevalent in the business and it seems to be the right word for this situation. ↩