1. What can Groovy do better that Java can't or cant do as good as Groovy?
Some blogs say Groovy is the super set of Java with lots in common - why this need arose?
Groovy is the evolutionary next step from Java. It's an OO language that simplifies Java in many ways (native collections, operator overloading, Groovy JDK), but also goes beyond what Java can do (closures, builders, metaprogramming). You don't "need" to use Groovy, but when you do use it, you're only adding to your Java knowledge. Groovy makes Java better, more powerful, and easier to use, but integrates with existing Java classes without a problem.
Rommel Sharma wrote:
2. Could any new features that groovy introduces not have been part of java in the upcoming release?
Java 8 includes lambdas, which are like Groovy closures but imply pure functions. Groovy will no doubt evolve to accommodate them. Java 8 still won't have a meta-object protocol, or anything like Groovy's AST transformations, or operator overloading, or the simplified syntax, or any of a wide range of Groovy capabilities.
Again, the question sounds like you're looking for a reason to do what Groovy does, but do it in Java. That's possible in some cases, but not necessary. You can add Groovy to existing Java and use them together.
Rommel Sharma wrote:
3. Which is the book that I can use as a reference for Groovy - the best you would recommend?
My editor would be annoyed with me if I didn't recommend my book, Making Java Groovy. The definitive reference for Groovy, however, is Groovy in Action, whose 2nd edition is current available through the Manning Early Access Program.
Kenneth A. Kousen wrote:My editor would be annoyed with me if I didn't recommend my book, Making Java Groovy. The definitive reference for Groovy, however, is Groovy in Action, whose 2nd edition is current available through the Manning Early Access Program.
And I think your publisher would be pleased that you mentioned not one, but two Manning books!
And I didn't even mention Grails in Action, Gradle in Action, or even Griffon in Action, which are all good.
Manning has obviously been very supportive of the Groovy ecosystem. If you're looking at other publishers, APress has The Definitive Guide to Grails 2 by Graeme Rocher and Jeff Brown, O'Reilly has a series on Gradle (Building and Testing with Gradle and the recently released Gradle: Beyond the Basics) and the excellent Programming Grails by Burt Beckwith, which should be everybody's second Grails book. Pragmatic Programmers has Groovy Recipes by Scott Davis, which is a bit dated, and Programming Groovy 2 by Venkat Subramanium, which was recently revised. I believe they're finally going to release a new version of Dave Klein's Grails: A Quick-Start Guide too.
I may be missing a couple, but those are most of the available books in areas related to Groovy.
I'm glad someone mentioned MrHaki (Hubert A. Klein Ikkink, believe it or not; @mrhaki is his twitter handle) and his "Groovy Goodness" book. He took the bold move of self-publishing. The LeanPub approach took his blog and built a draft version around that, which he then edited. When you buy his book (at https://leanpub.com/groovy-goodness-notebook), you're actually paying him and not the publishing company. That's partly why it's only available as an ebook.
His blog is a great learning resource, and the book is essentially a collection of articles he's written over the years.