The future is now — Java development in 2008

opinion
Jan 24, 200813 mins

What do the past 12 months tell us about the year ahead?

The year 2007 was full of exciting plot twists, punctuated by growing excitement about dynamic languages, the open source evolution of the JVM, and the rise of Google as a strategic contributor to the Java community. The question is, what does all that tell us about the year ahead? Andrew Glover has some answers for Java developers who need to know — now! — what’s coming in 2008.

French poet Paul Valery once lamented that “the trouble with our times is that the future is not what it used to be.” Valery’s comment was uttered years ago, yet his words are timeless for those of us living in the age of the Internet, fueled by the rise of the Java platform.

In the span of a little more than a decade we’ve seen Java applets come and go. We’ve seen the apparent demise of EJB, the rise of JSF, Spring, and Struts (not to mention the beginnings of Strut’s slow decline), and the redefinition of Java itself into both a language and a platform. The Java platform has split into three branches (Standard, Enterprise, and Micro) and the JDK has been released to the open source community. The Java language has expanded to include annotations, generics, enumerations, advanced collections, and more. It has also begun to share its home, the JRE, with dynamic languages like Groovy, JRuby, and Rhino, to name a few. In fact, if you think about it, especially over the last few years, we’ve collectively watched as the moniker of Java has transformed from a language into a veritable platform.

What we’ve learned in the last decade is that Java is much more than a language or a platform: It’s a community. It’s an economic ecosystem. It’s a living, breathing entity that has matured and grown into a veritable lifeline for a cornucopia of applications, and for large and small companies alike.

And so, despite some rumors to the contrary, I would argue that Java isn’t going anywhere but up in 2008. Rather than peer into a crystal ball and try to divine the future, let’s reflect on the major events and trends of the past year. Taken together, they reveal all we need to know about what’s ahead in 2008.

Halcyon days

The year 2007 was a roller-coaster ride driven, most dramatically, by growing interest in dynamic languages, the open source evolution of the JVM, and the rise of Google as a strategic contributor to the Java community. What’s more, wider adoption of unit testing, continuous integration, and other agile development techniques suggests that Java developers are beginning to view our craft as a profession that requires accountability. We are finally starting to focus on the quality and longevity of our code as much as its speed to market or immediate applicability in the enterprise.

All told, 2007 was a year of some clear triumphs, as well as some disappointments and squabbles that made for more bumps along the way than some in the Java community had anticipated. Consider the following major factors that shaped the year behind us.

Dynamic languages come of age

Groovy reached a pivotal milestone in 2007 with its 1.0 release, followed in short order by Groovy 1.5. Having come a long way over the course of five or so years, Groovy is positioned as an additional language for the JRE, not a replacement for the Java language.

Groovy’s big selling point is its shorthand syntax, which simplifies everyday programming activities. For instance, opening and reading a file is a typically verbose construct to code in normal Java:

try {
     BufferedReader in = new BufferedReader(
        new FileReader(path));
     String line;
     while((line = in.readLine()) != null){
       System.out.println(line);
     }
     in.close();
    }catch(IOException e){
      System.err.println("Exception reading");
    }

But the same code in Groovy can be written much more quickly:

new File(path).eachLine{ line ->
     println line
    }

Basically, Groovy (like other dynamic languages) permits you to drop exception handling, types, and semi-colons, and even permits more concise coding constructs that make the code ultimately easier to read (yes, that File object above is Java’s java.io.File).

Cast your net wide

Java IDE support for dynamic languages
With the zeal surrounding Ruby on Rails applications running on the JVM, and Sun’s hiring of two JRuby superstars, it was a brilliant move to position NetBeans as the IDE of choice for JRuby. Not to be left behind, IntelliJ IDEA embraced dynamic languages as well, with plugins for both JRuby and Groovy. Eclipse also has its fair-share of community-donated plug-ins.

Groovy wasn’t the only player on the dynamic language block in 2007, however. Java 6 (released in 2006) introduced a standard API for interacting with dynamic languages, which many Java developers began exploring in earnest late last year. The flagship integration for that API was Rhino, but it seems that more engines will be integrated with the Java 7 release.

One of the first languages slated for integration is undoubtedly JRuby, which rose to rapid prominence with its 1.0 release and the surprising realization that it is faster than Ruby itself! Like Groovy, JRuby (which allows Ruby to run on the JVM and interact with normal Java objects) makes Java development simpler by permitting a more relaxed syntax and adding a wee bit of magic. For example, using Ruby allows you to enhance normal objects, such as Ruby’s String to do things perhaps a bit more easily. In normal Java, checking if a String instance is blank may require using a method like what’s below (which is the Apache commons-lang implementation of isBlank).

public static boolean isBlank(String str) {
 int strLen;
 if (str == null || (strLen = str.length()) == 0) {
  return true;
 }
 for (int i = 0; i < strLen; i++) {
  if ((Character.isWhitespace(str.charAt(i)) == false)) {
   return false;
  }
 }
 return true;
}

String in Java is a final class, so you can’t extend it to add a new enhanced string type to support an isBlank method, for instance. Consequently, you have to rely on a separate library, like common-lang. With Ruby, you can alternatively define a blank? method on Ruby’s String object itself, like so:

class String
 def blank?
  empty? || strip.empty?
 end
end

Ruby’s style of dynamism permits adding behavior (like adding a blank? method to String) to core libraries — or any object, in fact — at runtime. What’s more, with JRuby you can retroactively add methods to core Java objects, too. Thus it takes just a little magic to add a blank? method to Java’s String class!

Opening up the heart

The open sourcing of Java last year means that the evolution of the Java platform is no longer solely in the hands of core Sun engineers: now it is up to all of us. OpenJDK, which embodies a GPL license around the Java class library, javac, and even the JVM itself, promises to usher in a whole new cycle of innovation — in fact, we’re already seeing it.

In October of 2007, a project dubbed Multi-Language VM was proposed under the OpenJDK charter. The aim of this project is to mollify the underlying infrastructure of Java for “prototyping JVM features aimed at efficiently supporting languages other than Java.” Clearly, this initiative blends two of last year’s most exciting developments — that is, the enthusiasm surrounding dynamic languages and the OpenJDK — to usher in a new age of innovation at the heart of Java.

Sun’s openness certainly didn’t start with the OpenJDK project — Glassfish, a Sun supported open source application server, also continued to gain a wider community throughout 2007. More recently, it is impossible to ignore Sun’s acquisition of MySQL AB, the corporate entity behind MySQL, which is arguably the prevailing open source database today.

All of these developments suggest that Java’s progenitor is embracing a business model that leverages open source software in a big way, which means we can look forward to seeing more openness in the Java platform in 2008 and beyond. Of course, all of this may have far-reaching consequences for commercial aspects of the Java ecosystem — which thus far appears to be quite healthy given Oracle’s recent 7 billion dollar purchase of BEA.

Google flexes

In late 2007 the mobile Java landscape, which had recently been somewhat scorched, was reinvigorated by the announcement of Google’s Android platform. Android aims to bring software applications to a new breed of mobile devices running an open source OS primarily led by Google. While Android is an entire platform (much like Java), the SDK for building Android applications is built on Java.

Moreover, Android’s Java is distinctly different from the Java of J2ME. In fact, the underlying JVM for Android is unique as far as JVMs go: it doesn’t run normal Java bytecode but a highly optimized format designed just for Android. Having multiple implementations of Java running on mobile devices means that we’ll most likely be seeing some interesting applications — which of course only adds to the ubiquity of the Java platform.

Google’s hand in Java went well beyond mobility in 2007, however. Of particular interest was the release of Guice, an open source dependency injection framework built on top of Java 5’s annotations and generics. While the big dog in the IOC market is still Spring, at the time of Guice’s public release it was a trailblazer, eschewing XML files in favor of annotations and Guice’s own Module types.

Given the weight of Google behind a second-generation IOC framework and the fact that Guice is relied upon for Google’s own AdWords infrastructure, it’s a good bet that it will continue to gain mindshare in the next year.

Agility goes mainstream — testing arrives!

The term agile isn’t new, nor are the practices of unit testing and continuous integration. Nonetheless, 2007 appears to be have been the year these practices became more mainstream. You couldn’t attend a conference without encountering one or more presentations focused on agility. More telling, a quick scan of the 2008 Jolt Awards finalists (which are chosen in 2007) for General Books and Technical Books shows a solid foothold for books about unit testing and continuous integration. Most important of all, however, is the fact that both established frameworks and new players to the field have begun to tout how easy their particular architecture is to test! It seems that developer testing has finally arrived.

Not all Sun and games
The last year unveiled some rather unfavorable developments for Java. Most notable was the absence of Java on Apple’s iPhone and the lack of Java 6 on the newest version of OS X. While the deeper implications for Java on the Mac remain to be seen, it was hard to read anything positive into Apple’s failure to include Java in these two major releases.

Java’s growing pains

While it’s clear that Java is becoming more a platform than just a language, the Java language has continued to grow and expand. For better or for worse, features have been added and will continue to be added, should the community find them acceptable.

Some features are not as welcome as others, however. For instance, annotations were a win for the masses — frameworks like JUnit 4, TestNG, Spring, and Google’s Guice grabbed impressive developer mind-share through innovative uses of annotations. Conversely, generics (which were introduced in Java 5) have so far been inconsistently adopted– at least in their full spirit.

No closure(s) in sight …

If generics didn’t cloud the coding landscape enough, one might find the current discussions surrounding the proposed addition of closures and local functions into Java 7 foggy indeed. While I certainly won’t argue their usefulness as constructs, adding them to the Java language syntax could obviate their usefulness by increasing conceptual entropy.

For example, in a prototype reference implementation of closures, one can find the following code, which defines a simple closure supporting Integer addition:

{Integer,Integer=>Integer} plus1 = {Integer x, Integer y => x+y};

What’s particularly interesting is the verbosity of the statement due to Java’s innate syntactical requirements — one could easily rewrite the same functionality in Groovy, for example, as

plus1 = { x, y -> x+y } 

Note that the dearth of types arguably makes human parsing of the code’s intent easier in the Groovy example. Of course, Ruby’s version would be as terse too.

It’s clear that outside forces, such as the popularity of dynamic languages (which already include closures) are influencing Java. You don’t have to wait for native closures in Java 7 if you want to use them, though — both Groovy and JRuby support them quite nicely.

True concurrency

Something else to look forward to with Java 7 is the release of the java.util.concurrent packages, which aim to address true concurrency for Java applications by leveraging underlying hardware. While Java has always supported threading, hardware assets continue to become more robust through a greater emphasis on parallelism; consequently, the Java language is growing to meet these demands.

Led by the JSR 166 Expert Group, Java 7 will most likely include a few new features including a fine-grained parallel computation framework dubbed join-fork. The good news is that it appears these features are new classes (and APIs) and are not syntactical in nature.

The race to RIA

Rich Internet Applications continued to generate lots of interest among Java Web application developers last year, especially after Sun unveiled JavaFX at JavaOne 2007. The JavaFX product family currently consists of JavaFX Script and JavaFX Mobile.

Reaction to JavaFX appears mixed given the ubiquity of JavaScript for developing Ajax-like applications. It has also been suggested that JavaFX Mobile could widen rifts in an already fragmented mobile environment. All told, many in the community found the JavaFX announcement rushed, and some question whether it is vaporware. Nevertheless, Sun’s entrance into the RIA space surely signals a long-term strategy, which further secures Java’s future.

In conclusion

An African proverb states that Tomorrow belongs to the people who prepare for it today. Thus, the future of Java (at least for the next year) has already been brewing for some time. The events of 2008 will largely be shaped by the JVM itself, as languages like JRuby and Groovy grow in popularity and eventually gain enterprise-wide adoption. The promise of using Java to develop consumer mobile applications also seems more accessible than it has for some time, given Google’s foray with Android and Sun’s with JavaFX Mobile. Most of us will also be concerned with leveraging the emerging multicore systems and looking to Java 7’s java.util.concurrent packages for answers. Lastly, open source Java and the business model surrounding it will continue to grow.

Acknowledgments

I’d like to thank the following individuals whose valuable insights regarding all things Java helped shaped this article: Neal Ford, Andres Almiray, Dan Allen, Ted Neward, Scott Stirling, Scott Moore, John Smart, Nate Schutta, Michael Nyika, Venkat Subramaniam, Guillaume Laforge, Scott Delap, Paul Duvall, Yvonne, David Pinkham, Rod Coffin, Andrew Binstock, Ken Brooks, Jay Zimmerman, Paul Julius, Tom Copeland, Navjeet Chabbewal, Jason Rudolph, Chris Judd, Dave Aronson, Cliff Berg, David Bock, and finally Alex Ruiz. Thank you all for answering my questions!

Andrew Glover is president of Stelligent Incorporated, a consulting firm that helps development teams accelerate software development. He blogs regularly at thediscoblog.com and testearly.com.
andrew_glover

When Andrew Glover isn't listening to “Funkytown” or “Le Freak” he enjoys speaking on the No Fluff Just Stuff Tour. He also writes articles for multiple online publications including IBM's developerWorks and O'Reilly’s ONJava and ONLamp portals. Andrew is also the co-author of Java Testing Patterns, which was published by Wiley in September 2004; Addison-Wesley’s Continuous Integration; and Manning’s Groovy in Action.

More from this author