Groovy will replace the Java language as dominant language

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.

3.166665
Average: 3.2 (6 votes)

(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 - 7: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 - 8:02am in response to: gr34134

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 - 8:06am in response to: sdevijver

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 - 8:09am in response to: gr34134

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 - 8: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 replied on Wed, 2008/02/13 - 8: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 - 8:45am in response to: mjais

@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 

Graeme Rocher replied on Wed, 2008/02/13 - 9:11am in response to: SergeBureau

SergeBureau wrote:

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. 

 

I think we are indirectly agreeing with each other. My point is that the integration is so seamless that I find myself naturally switching from one to the other. In other words its not a binary choice.

 Ask any Groovy guy we are not in the "Java is dead, a Ruby/Scala/x language is here to kill it" camp. Groovy is currently the only language that allows true polyglot programming without the pain of context switching, its the act of using it together with Java that makes it so powerful.

Mihai Campean replied on Wed, 2008/02/13 - 9: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 - 9:35am in response to: mihaicampean

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 - 9:40am in response to: gr34134

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 - 10: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 - 10:09am in response to: rick

Agreed 100% Rick.

Fabio Akita replied on Wed, 2008/02/13 - 10: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 - 10:17am in response to: rick

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

Mihai Campean replied on Wed, 2008/02/13 - 10:21am in response to: gr34134

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 - 10: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 - 10:36am in response to: rick

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. 

ff aaa replied on Wed, 2008/02/13 - 10:37am

well, i thought scala was replacing java this year?

Jokes aside, please stop spewing this kind of articles for sake of publicity. Groovy is a nice language, but please. If anything, Java needs a clean up and more syntatic sugar to eliminate boiler plate (like python is doing). Two languages are different discipline. one cannot replace the other.

Tim Goeke replied on Wed, 2008/02/13 - 10:55am

Java will always hang around like Cold Fusion or Cobol or those old shoes in the back of your closet.  What's exciting is that we are waking up from a 30 period where everything sort of stopped and we are now entering a period where new languages and ideas are being pushed and new languages are being created. 

We all know that there needs to be a better way to make software, and Groovy is a step in that direction.  Software is hard, largely because we are trying to model the real world.

I was in physics class and someone had scratched "physics sucks!" on the desk.  Right beneath it was written, "It's not physics that sucks, it's the world, physics just describes the world."

 As we attempt to describe and actually model the world, programming that's any fun or impactful is very hard, and we have not made much progress since 1968.  Yes, there has been progress, but not the progress that many, such as Alan Kay, had expected. (He blames Microsoft and Visual Basic.)

 

Currently I am using Groovy at work and JRuby at home, and I like both.  I am like ruby because gem is nice.  Hopefully Grape will be equally as nice.  JRuby seems to bridge both Java and Ruby worlds, and so you have 99% of the Java world and 95% of the Ruby world fused together.  That seems to be a more powerful combination than Java + Groovy.

I also like the idea that ruby does not have "java think".  There's a certain simplicity in the ruby world that's missing from java.  It seems that Groovy got it's inspiration from the python world but also the ruby / rails world.  In my little opinion, the ruby world is the precursor and thus the source.  Groovy is the follower, and the fact that ruby and python have worlds outside the JVM and outside of java think means that there will always be the potential for novel advancements in our field.  What I hate to see is lateral moves (rails, grails, now rhino on rails, etc.)  I hope to see more advancement.  (How about a better HTTP, concurrency advancements, AI in our programs so that they are actually smart...)

I believe we are on the cusp of a big shift and Groovy is on the leading edge, and going in the right direction.  Just keep moving forward!  Don't rewrite the world in Groovy, invent the future, a new world, and use Groovy to advance towards that cause.

  

David Lee replied on Wed, 2008/02/13 - 11: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 - 11: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 - 11: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 - 11: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 - 11: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 - 12:27pm

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 - 12:34pm

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 - 12:58pm

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 - 1:16pm in response to: jwenting

jwenting wrote:

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.

 

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.

Steven Devijver replied on Wed, 2008/02/13 - 1:28pm in response to: gr34134

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.

Graeme, I feel I have to respond before this gets out of hand. Does my article say Groovy will replace Java?

I can't believe I have to quote the article on top, but here goes:

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.
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.

(Grails and easyb built on top of the fact that Groovy integrates so well with Java)

Groovy will become very, very popular is what I'm saying. As such its market share will become so important that it will gradually close in on the Java language. Groovy's perfect integration with Java will probably be the main reason for its popularity.

Steven

Comment viewing options

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