Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Greasing the wheels of Java - What's up with all the hype on Ruby and Groovy?

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I've been developing .Net applications and J2EE applications for a while now, but i've been quite away from scripting which seems to be a hype now, can this book introduce me to such technologies or is it an advanced level book? One needs to catch up with events.
 
Ranch Hand
Posts: 471
Mac OS X Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mohammed,

From the table of contents, the first 3 chapters "Introduction", "Getting Started" and "New to Groovy" seem to be for real beginners. Even the description of the book on the book's page states that this book is for java professionals. I believe that this book requires absolutely no prior knowledge of groovy.
 
Author
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, allow me to offer a gentle syntax correction... (wink) It's easy to dismiss Ruby, Groovy, et al, as "Just a scripting language" if you are so inclined. These languages are better described as "dynamic" languages. Groovy is "just as" compiled as Java is -- sometimes the Groovy interpreter does it for you on-the-fly, but you can just as easily call the "groovyc" and compile it yourself. (I'm assuming you meant no harm -- just having a bit of fun with you...)

Groovy offers a dramatic simplification of the Java language, while simultaneously offering you more power as well.

You mention doing web dev. If you having been looking into the RESTful revolution (REST is a modern form of web services that is slowly replacing legacy SOAP services), you'll find that Groovy really makes it easy. For example, let's say that you want to pull in the current weather conditions for your zipcode. The url is "http://weather.yahooapis.com/forecastrss?p=94089". The Groovy code to download the XML and store it in a String variable is as follows:



One line and you have the XML. (That URL class, BTW, is a standard java.net.URL class.) You can then use an XmlParser or an XmlSlurper (two Groovy libraries for parsing XML) to just as easily walk through the XML results.

The secret to Groovy's success is not reinventing the wheel -- it takes many of the standard JDK classes and dynamically adds new methods to them at runtime -- yes, even Final ones, so String gets a whole host of new functionality.

The hype/excitement about these new dynamic languages is all about their dramatic reduction of LOC coupled with their sophisticated metaprogramming capabilities.

You ask for a book recommendation, so I'll give you two...

My book (Groovy Recipes) is a very tactical book -- "How do I parse an RSS feed?" You get the short code snippet and a few supporting paragraphs. If you want to get in, get out, and get on with it, I think you'll enjoy it.

My good friend Venkat Subramaniam is releasing a book called Programming Groovy with the same publisher -- Pragmatic Bookshelf. His book is a much more strategic book -- he has whole chapters on metaprogramming, writing DSLs (Domain Specific Languages), unit testing, etc. I think that the two books are take a very yin/yang approach to the same language.
 
A magnificient life is loaded with tough challenges. En garde tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic