Steven has posted 36 posts at DZone. View Full User Profile

Groovy will replace the Java language as dominant language

02.13.2008
| 43866 views |
  • submit to reddit

Hear me out. In 2 to 3 years from now there we will see strong indications that Groovy is replacing the Java language as the dominant language on the JVM. Actually outnumbering the Java language will be very hard, given its 10+ years of history. But the trend will be clearly with Groovy.

I realize this sounds like an extra-ordinary claim, maybe even sounds baseless. But it's not. I've recently come to terms with the increased adaptation of Groovy as a programming language myself. Before laying out my arguments to support the increasingly important role of Groovy, let me first lay out some of the history of the Groovy language.

The Groovy project for a long time has been a wild dream. Groovy is the dream child of James Strachan, extravagant open-source developer and visionary. While waiting for a delayed flight he was playing with Python and found it such a cool language that he decided the JVM needed to have a language like this too.

Groovy has always been closely related to the Java language. Not only is the Groovy syntax similar to and often identical to the Java syntax, Groovy is the only language together with Scala and of course Java that always compiles to true Java byte-code. This means that Groovy classes are always true Java classes.

But Groovy has known a rough history. I'm sure many people would prefer not to be remembered, but Groovy was on the brink of failure in 2003/2004. It got a lot of bad press back then and was written off by many people, including people that were involved in the project. Groovy made it through this storm thanks to the hard work of a team of very dedicated people. At the start of 2007 Groovy 1.0 was released and now we're looking forward for Groovy 1.6 and Groovy 2.0.

From the period of Groovy's near failure I remember that everybody had an opinion of what Groovy had to be like. Most people liked the Groovy language, but it had to be more like Perl, or more like Ruby, more functional, less Java, more Java. Every week there were enormous discussion on the mailing lists about which features Groovy had to support. This chapter in Groovy's history is behind us.

Since 2005 the Groovy team has regrouped and been working hard to improve the language. They've incorporated many suggestions and continue to do so until this day. But you won't find many discussions today on which direction Groovy should take. We're past 1.0, the language is stable.

Groovy is a dynamic language, meaning Groovy does not do type checking on variables if you don't want it. Groovy can do type checking but its optional. Here's an example of Groovy code that does not do type checking:

def list = []
assert list.empty

Here's the same code with type checking:

List list = []
assert list.empty

In a way, the Java language is a non-dynamic language that always does type checking.

So, why do I think Groovy will replace the Java language as dominant language? I'll break down my arguments in two categories.

First, why the Java language won't remain the dominant language:

  • The Java language community is sinking into a deep crisis over change. There's the row over whether or not closures have to be added to the Java language, and which proposal should be selected. This reminds me of Groovy's history. With each change to the Java language tool vendors have to adapt with it. This is a slow process, and the closure proposals I've seen are not nearly as powerful as closures in other languages, including Groovy. Adding this kind of features can happen a couple of times. The pressure to consolidate will however increase. By the time this happens we're 2011. The Java language will have new features at the expense of several massive investments by many parties who will grow increasingly impatient.
  • Java language changes are driven by Sun and marketing. C# gets annotations, Java need to have annotations. C# gets closures, Java needs to have closures. See the pattern? This does not serve the Java user community. Actually, we're completely shut out.
  • The Java language will be forked. As some people will grow more frustrated with the way the Java language is managed there's a very real possibility that the Java language will be forked, even if it's only for the sake of creating prototypes or making a point. This may be conceived as dangerous or at least make some people nervous, re-enforcing the point for the design-by-committee culture even more.
  • Static typing is a great feature and every object-oriented language needs it. It's not so great when there is no alternative. For example, it's unlikely that new methods will be added to the java.util.Collection interface to support closures. For Groovy dealing with new methods on java.util.Collection would be a non-issue. This feeling of being stuck with certain types will increase the sentiment that the Java language may be at a dead end.

So, then why should Groovy become everybody's favorite, especially now that Sun officially supports JRuby? And what about Scala?

  • Sun supports Groovy too. Some of their employees are working hard on the Groovy plugin for the NetBeans IDE.
  • Of Groovy, JRuby, Scala it is Groovy that comes closest to the original Java syntax.
  • Java should always have been a dynamic language. Groovy gives us a glimpse of what the Java language could have been.
  • IDE support for Groovy will be very impressive in one year from now or less, making its integration into projects much more likely.
  • Dynamic languages can have very good IDE support like type detection and code completion. If Visual Studio can have excellent integration for F# then the same is possible for JRuby and Groovy as well. In fact, the NetBeans IDE plugin for JRuby is already impressive.
  • Groovy offers joint Java compilation, meaning that .java and .groovy files get compiled at the same time. Java classes can thus extend Groovy classes without a glitch.
  • As Groovy IDE support improves - which is already decent for IntelliJ - more and more frameworks for Java will be written - at least in part - in Groovy. This is already happening. Don't expect the same to happen for JRuby. It could happen for Scala.
  • Two to three years from now the performance of dynamic languages like JRuby and Groovy will be equivalent to pure Java code.
  • Grails 1.0 is a huge step for the Grails and Groovy communities, but it's a small step compared to what's ahead of us. Both in terms of Grails and in terms of new ideas.
  • As Groovy starts to play an increasing role in software development an increasing number of developers will be touched. Think Grails, think easyb, think of some novel new use of Groovy yourself.
  • There's genuine interest in Groovy and Grails, and it's growing. Now is our moment to seize these opportunities and make it easier for people to start using Groovy. The trend is with us, let's make it stronger.

It's going to be a very interesting 2 years for Groovy and Grails. The moment is ours and the demise of the Java language has to be Groovy's stepping stone.

Happy coding!

Note: as Graeme Rocher points out in the comments, Groovy won't compete with Java anytime soon on mobile devices.

Published at DZone with permission of its author, Steven Devijver.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Graeme Rocher replied on Wed, 2008/02/13 - 6:37am

Interesting article, but as project lead of Grails and Groovy core committer, I don't agree with you ;-)

 I anticipate Groovy will enter the top 10 languages world wide next year and will be closing in on the top 5 at the end of 2010, but replace? no.

Groovy (and Grails) is designed from the ground up to be used in conjunction with Java, it is not a binary choice. You use Groovy where it makes sense and Java when it makes sense.

 Each language has their respective strengths. I see a future where Groovy is used more and more for various aspect of software development on the JVM where it makes sense. Sometimes you might find an entire Grails application written in Groovy without a line of Java, but the majority of cases I believe will see them used together.

Steven Devijver replied on Wed, 2008/02/13 - 7:02am in response to: Graeme Rocher

Hey Graeme,

It depends how you count. If Groovy is used together with Java it's a 0.5 for Groovy and 0.5 for Java.

However, applications written with Grails are likely to have no Java code at all, so that's 1 for Groovy and 0 for Java. Given five more years of Groovy and Java evolution - both share the same ecosystem - things could turn out in surprising ways.

Steven

Graeme Rocher replied on Wed, 2008/02/13 - 7:06am in response to: Steven Devijver

Sure, but there are many places where Groovy is just not applicable. For example there is a huge amount of Java stuff happening on mobile phones and embedded devices where Groovy just doesn't run.

 Then there are things like GWT and Andriod. Java, in my view, will continue to be hugely popular as a low-level plumbing language. In other words, the web application development space is only one part (although quite a large part) of the overall Java community.

Serge Bureau replied on Wed, 2008/02/13 - 7:09am in response to: Graeme Rocher

I disagree with you Graeme,

Groovy is the first language  that attracts me since Java itself,

 and you are wrong in saying that we use it with Java, it is more like Java is a part of Groovy, so you do not have to mix as Java code is also Groovy code.

 

This is a natural extension of Java, and I am sorry but Ruby and Scala's syntax are awful.

So if Groovy convinced ME to start to use it, it will be very popular.

And adding the scripting capabilities is priceless. So Java will live on, but inside Groovy. 

Serge Bureau replied on Wed, 2008/02/13 - 7:11am

@Steven

 I agree with your prediction, since Java itself Groovy is the first language to really give me some excitement.

 

It adds scripting and does totally preserve Java, WOW ! 

Markus Jais replied on Wed, 2008/02/13 - 7:37am

@Serge: some people like the Ruby syntax, others hate it. I like both Ruby and Groovy. It's a metter of personal preferences.

about Groovy replacing Java: I am with Graeme here.

but in the long run, I just don't care. Frameworks are much more important than the language.

For details see my blog post here:

http://codekite.com/general/its-the-framework-not-the-language

 

Markus

http://www.codekite.com

Serge Bureau replied on Wed, 2008/02/13 - 7:45am in response to: Markus Jais

@Markus

 

About the syntax, it is directly related to the acceptance.

People comming from C++,C#,Java will be at ease with the Groovy syntax, so which language do you think they will choose ?

 Now as far as being with Graeme, please look at my reply to him. Groovy is Java ! So where do you see we lose the framework ?

 

Serge 

Mihai Campean replied on Wed, 2008/02/13 - 8:11am

I have to agree with Graeme on this one, I think there is a long way to go until Groovy can replace Java entirely. It is nice to think of running Groovy applications on mobile devices and also it is very good to see the increasing interest and support that is being put into Groovy (I just hope that it won't be one of those hypes that will pass out quickly), but I believe that there is a long way until replacement of Java by Groovy. Let's not forget the tons of legacy code that works in Java and the heavy applications that use it. Large companies invested a lot of time and money in their systems and from my experience, they are pretty conservative when it comes to conversions, migrations and new technologies. Sure, Groovy is much lighter, helps in faster development and it is very much integrated on the JVM, it also suceeds where Java seems to fail because of the change crisis you mentioned, but I still think it would take some time for it to replace Java, if that ever will come to pass.

Meanwhile, I think knowing Groovy will make as a good skill to have on your CV for future jobs so, I think we all should start learning it ;).

Graeme Rocher replied on Wed, 2008/02/13 - 8:35am in response to: Mihai Campean

Indeed Mihai. It is all too easy to get carried away with these things, but we have to remember the broad scope of Java. Also, if you look back at history people were saying in the early days of Java that it was going to replace C++. Yes, it has become the worlds most popular programming language, but replaced C++? no.

There is still plenty of C++ code being written at the OS level, for drivers, real time systems, games, embedded devices etc. Java isn't going to replace it anytime soon (although as the VM gets faster the reasons not to use Java are becoming less prominent), just as Groovy (or any other language of the current trendy languages such as Ruby/Scala/etc) is not going to replace Java.

Having said that it doesn't mean Groovy isn't going to become big (just as Java is big), as I said I believe it will become one of the biggest languages around and bring to halt the exodus of some Java devs to other platforms.

Serge Bureau replied on Wed, 2008/02/13 - 8:40am in response to: Graeme Rocher

Now I do totally agree with your last post.

You are right, there is no context switching, that's what is making it so compelling. 

Rick Ross replied on Wed, 2008/02/13 - 9:03am

Isn't one of the most fundamentally attractive qualities of Groovy/Grails that they build on the foundation of everything that Java offers, while adding many of the dynamic language benefits people extol from Ruby/Rails, etc?

If I have understood correctly, the person who has invested years in building Java expertise loses little or nothing in a move to Groovy/Grails, but a jump to Ruby/Rails would imply a near-total reset. Similarly with tools and libraries - all your Java stuff just keeps on working.

Maybe "replace" isn't the right verb? Perhaps it is "enhance" or something more positive that incorporates the best of Java's solid foundation and adds valuable new semantics and paradigms?

Graeme Rocher replied on Wed, 2008/02/13 - 9:09am in response to: Rick Ross

Agreed 100% Rick.

Fabio Akita replied on Wed, 2008/02/13 - 9:10am

Totally agree with Graeme. Java is not going away any time soon, not even 5 to 10 years. It really doesn't matter whether it is passing through a political struggle today. 

Ola Bini nailed this one once. The Java Platform will be great with at least 2 kinds of languages: one has to be a systems language, the "low level" language per se. This is the current Java.

The other kind are "Application Languages". This is Groovy, or Scala, or JRuby. 

By the way, congratulations to the Groovy and Grails teams. You're really getting it right.

And yes, I am a Ruby on Rails developer ;-) Doesn't mean I can't like other platforms as well. 

Mihai Campean replied on Wed, 2008/02/13 - 9:17am in response to: Rick Ross

Indeed, "enhance" is a much more positve verb to be used in this case.

Mihai Campean replied on Wed, 2008/02/13 - 9:21am in response to: Graeme Rocher

I sure hope that Groovy will become one of the big languages, it certainly has that potential.

Sultan Rehman replied on Wed, 2008/02/13 - 9:36am

I don't think Groovy will become the dominant language for the JVM anytime soon, if ever.

What's becoming more obvious is that the age of a polylingual programming environment has arrived for the JVM. I agree with Fabio above that what's more likely to happen is that a couple of (or more) statically typed, highly performant, languages such as Java and Scala will become the language of choice for systems/framework/business-level programming while a few scripting/dynamic languages, such as Groovy and Ruby, will increasingly be used as glue languages and also UI code.

Having said that, personally, I feel Scala actually has a lot of potential, for many shops, to be able to cater to both levels. But thats just my personal bias :)


Alex Tkachman replied on Wed, 2008/02/13 - 9:36am in response to: Rick Ross

Absolutely correct. To Enhance not To Replace.

Groovy allows you to leverage your existing skills and infrastructure. There is no point to drop off all great staff you already have. 

David Lee replied on Wed, 2008/02/13 - 10:01am

for web development, it's very hard to see how groovy doesn't become the language of choice(for existing java developers).  For new development, when execution speed is second to getting something out the door I suspect groovy will be favored.  It may not completely replace java, but when given a choice between java and groovy, particularly for new projects ,groovy looks more attractive.

Artur Biesiadowski replied on Wed, 2008/02/13 - 10:06am

My child has doubled it's age last year, I have increased it only by 3%.  In fact, percentage of growth for my age show clear decline since I was born. Assuming that my child will continue it's trend, it will become older than me in 4-5 years. Actually, when I look at it growing and how often clothes has to be changed, I assume that percentage growth can even be bigger in next years, so it should be older than me in 3 or less years. At the same time, I should become younger very soon, as flat growth is a best indication of incoming decline.

Too bad I cannot bet with you big money on "Two to three years from now the performance of dynamic languages like JRuby and Groovy will be equivalent to pure Java code". Two years ago groovy was 300+ times slower than java. Currently it is probably only 180 times slower than java. Indeed it is quite obvious that in 3 years it will be as fast as java. In 10 years, interpretation of x86 assembly code in groovy with be faster than running it natively on cpu.

cowwoc replied on Wed, 2008/02/13 - 10:12am

I have two major issues with Groovy:

 

1) I will never willingly use a dynamic-typed language. You can quote me on this one.

2) I don't like its syntax.

 

I am all in favor of a "cleaned up Java" fork that developers will eventually migrate to where backwards compatibility is dropped in a few places in order to improve the cohesiveness of the language and drop deprecated APIs in favor of new ones, but I see no similar value in Groovy.

 

The proposed Closures syntax is pretty much exactly what I *don't* want to see in any language I end up using. I want a minimalistic language, not one that throws the kitchen sink into it. Java is still pretty minimalistic at its core which is why I keep on using it.

Guillermo Schwarz replied on Wed, 2008/02/13 - 10:13am

History repeats itself.

 It was 1993 and C++ was too complex. A lot of people argued that Awk and Perl was the next big thing, because they were dynamic, they had no compilation time and therefore programmers were so much productive. I did some tools in Perl to help me with the real development in C++.

 Guess what. C++ code was still understable a few years later, while Perl script were a big pile of mud.

So I can imagine what will happen with the developers who move into Groovy, Ruby and all those dynamic languages: they will work, but they will grow unmodifyable. If you like scripting languages, maybe your Java code is mess anyway, so the language will not matter.

 But if you really care, you should be using Java.

The only language that at least to me is as dynamic as an scripting language, but as formal as Java is Smalltalk. Actually Smalltalk is a lot less formal than Java, but its syntax is a lot more easier.

 Wouldn't it be easier if we could just write all the code in Java and avoid all the JSP nonsense? I just created that, a framework that allows me to code everything in Java. It is really easy and fun to program in it. Productivity skyrockets.

Derrick replied on Wed, 2008/02/13 - 10:44am

Wow... You need to get out more. That's quite a boastful claim.

Maybe this is true in the small piece of the programming world that you see.


 

Matthew Adams replied on Wed, 2008/02/13 - 11:27am

Well, I don't know about Groovy's replacing Java, but it is one of a very few things that has gotten me excited about things. Since 2000 or so, the only things that have come about that I got excited about were JDO, AOP & Spring. Groovy is certainly on par with those!

Jeroen Wenting replied on Wed, 2008/02/13 - 11:34am

Groovy has been saying it's the best thing since sliced bread and that it will be preeminent "soon" since before it was even released.

Pardon me for being sceptical, but I am. If Groovy is going to "replace Java" it'll first have to get past a lot of other languages that have more marketshare than it does, like Ruby, C#, Python, C++, etc. etc.

And to be honest I'd at the moment use any of them sooner than use Groovy.

 We've been hearing that "Java is dead" for over a decade now. You can almost set the clock by posts like this, they appear with such regularity.

John Wilson replied on Wed, 2008/02/13 - 11:58am

I'm not really sure I understand what you mean by "dominant". If you mean that it will be the language which will be adopted by most of the existing hard core Java programmers to build their messaging, graphics, SOA, etc. frameworks then I really can't agree with you. If you mean that most of the programmers writing code for the JVM will be using Groovy for some of the time and many will be using Groovy for all their work on the JVM then your position is, at the least, arguable.

I have been involved in the project since a couple of months after it started. It has never been the intention of competing with or supplanting Java. Groovy has always been intended as an adjunct to Java. One sector of the target audience for the language is skilled Java programmers who see how to use Groovy to make their lives easier or to allow their users to extend and configure their programs (unit testing, mocking, rapid prototyping, XML manipulation, building DSLs, etc). However this is only one sector of the audience and only a tiny proportion will do all their JVM programming in Groovy.

The exciting thing about Groovy is that it extends the reach of the JVM. It allows people who do not want to bother with Java to create programs on the JVM using the wonderfully rich set of libraries available on that platform. So people who are happy with VB or PHP are attracted to Groovy because it gives them an environment they are familiar with. In addition, people with no real programming background seem to ba able to become productive in Groovy very quickly (the first mission critical Groovy app deployed was written by a team of actuaries).It is possible that Groovy could become the most widely used programming language on the JVM but if it does it will not be because the number dedicated Java programmers are converted to dedicated Groovy programmers it will be because the range of people writing for the JVM is massively expanded.

This is not a zero sum game. Groovy does not aim to be the biggest fish in a smallish pool it aims to make the pool as large as possible.

Graeme Rocher replied on Wed, 2008/02/13 - 12:16pm in response to: Jeroen Wenting

[quote=jwenting]

Groovy has been saying it's the best thing since sliced bread and that it will be preeminent "soon" since before it was even released.

Pardon me for being sceptical, but I am. If Groovy is going to "replace Java" it'll first have to get past a lot of other languages that have more marketshare than it does, like Ruby, C#, Python, C++, etc. etc.

And to be honest I'd at the moment use any of them sooner than use Groovy.

 We've been hearing that "Java is dead" for over a decade now. You can almost set the clock by posts like this, they appear with such regularity.

[/quote]

 

It is fine that you don't like Groovy, no problem its a free world. However, this is the first article I have seen (and as I said I disagree with it and it is not the view of the Groovy community) that has stated Groovy is going to replace Java, most of that noise has come from the Ruby/Scala/Erlang/x language camps.

 Groovy was never designed to replace Java, its design to be used in conjunction with Java. You may have been hearing "Java is dead" for over a decade, but it certainly hasn't been coming from the Groovy community.

Osvaldo Doederlein replied on Wed, 2008/02/13 - 12:29pm

I like Groovy a lot, it's certaily much better (as a language) than alternatives like Ruby or Python. But last time I checked - not too many months ago - its performance was still a huge issue, one or two orders of magnitude worse than equivalent Java code in many syntethic benchmarks. Granted that we don't have a good application-specific benchamark like SPECjbb2005, or at least a good syntethic benchmark like DaCapo. Groovy versions of these woukd be great.

 I say that even with the productivity advantages of an easier, more expressive syntax, Groovy won't steal a large share of Java's space even in business application projects, even though these projects are database/communications-intensive... unless Grooby's disadvantage is much less than one order of magnitude. Perhaps 0,5X or 2X worse is acceptable; 5x, 10x or more are definitely not. Yes, I lnow that languages like Ruby (with its pathetic runtime technologies like the MRI interpreter) are hideously slow; but these are different communities and ecosystems... Groovy will be approached by Java programmers, who are very comfortable with the high performance of the Java language (and still demanding more - see the endless stream of new HotSpot optimizations, APIs like NIO and j.u.c, performance-oriented language RFEs like lightweight objects, etc.). Groovy supporters should not make the mistake of thinking that Java coders won't bother with a massive slowdown in their app code, even in niches like CRUD/web apps where this code is not a bottleneck.

Also... agreeing with cowwoc, I'll hack on a dynamically typed language the day hell freezes over. Give me a modern static-typd language like Haskell or Scala, with type inference to spare me from redundant declarations. Give me Java 7 with typedefs and limitedtype inference for less verbose generics. In the worst case, even the current Java language makes me happy, compared to languages that require a huge number of extra unit tests just to avoid type-safety bugs. Not to mention that performance sucks too, remarkably as one must leave behind the undisputable efficiency of unboxed primitive types and arrays. Groovy is already a good compromise as it allows optional static declarations, but it's not a complete solution yet. Perhaps good enough so I'll use it for some apps, if all other problems are solved.

James Childers replied on Wed, 2008/02/13 - 12:35pm

As long as Groovy doesn't play nicely with log4j it is, unfortunately, not going to be a good fit for many organizations. I use it personally, and like it, but only as a local prototyping/testing tool. And while it is superb in this role, organizations with deep ties to log4j are going to be averse to adding $GROOVY_HOME to their production environments. 

Rick Hightower replied on Wed, 2008/02/13 - 12:48pm in response to: Graeme Rocher

RE:  I anticipate Groovy will enter the top 10 languages world wide next year and will be closing in on the top 5 at the end of 2010, but replace? no.

I agree with Graeme Rocher.

I really like Groovy. Before the adoption comes, sadly, the hype and religious fervor comes. Groovy will do quite well. It will be a long time before it can touch Java's popularity. I'd give it a 30% chance of being a dominant language on the JVM. (5 years, 10 years... never?)

Groovy is very productive and I really enjoy programming with it (GPath, builders, closures and more). It is a good mix of the features of Python with the environment of the JVM plus a lot more.

The lack of IDE support was the biggest obstacle to Groovy adoption and now there is excellent IDE support for Groovy. IntelliJ Groovy plugin support for Groovy makes Groovy a first class Java citizen and it is easy to mix and match Groovy and Java. Now the Eclipse plugin for Groovy has gone through several iterations of improvement and is fastly approaching this level of usability, when that happens a lot of doors will be opened for Groovy.

Groovy can be strongly typed, and yet is a dynamic language with modern language features. It truly takes the best features from Perl, Python, Ruby and mixes the together in a very Java-centric fashion. I have been working with it and really enjoy programming with it.

I don't think I will ever go back to Jython/Python.

rick hightowercto of arcMindbloglinkedin

Rick Hightower replied on Wed, 2008/02/13 - 12:53pm

I don't agree with the original post. Groovy is very productive and I really enjoy programming with it (GPath, builders, closures and more). It is a good mix of the features of Python with the environment of the JVM plus a lot more. The lack of IDE support was the biggest obstacle to Groovy adoption and now there is excellent IDE support for Groovy. IntelliJ Groovy plugin support for Groovy makes Groovy a first class Java citizen and it is easy to mix and match Groovy and Java. Now the Eclipse plugin for Groovy has gone through several iterations of improvement and is fastly approaching this level of usability, when that happens a lot of doors will be opened for Groovy.Groovy can be strongly typed, and yet is a dynamic language with modern language features. It truly takes the best features from Perl, Python, Ruby and mixes the together in a very Java-centric fashion. I have been working with and really enjoy programming with it.I really like Groovy. Before the adoption comes, sadly, the hype and religious fervor comes. Groovy will do quite well. It will be a long time before it can touch Java's popularity. I'd give it a 30% chance of being a dominant language on the JVM.  (5 years, 10 years... never?)I love Python. I prefer Groovy to Python. I find Groovy is very productive.
rick hightowercto of arcMindbloglinkedin

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.