Gregory Pierce has been active in enterprise, mobile and game development for a number of years. Greg's background includes serving on the Java Gaming communities board of directors, serving as Director of Research and Development for Zenimax Media/Bethesda Softworks, working on a variety of government counter narcotics and visualization/simulation projects, authoring several papers and giving various presentations on J2ME, coauthoring Direct3D Professional Reference, and contributing to various open source projects from Jboss to LWJGL. Currently, Greg works as a Solutions Architect for JBoss, a division of RedHat in Atlanta Georgia.
| Author(s) | Dierk Koenig with Andrew Glover, Paul King, Guillaume Laforge and Jon Skeet |
|---|---|
| Publisher | Manning |
| PubDate | January 5,2007 - First edition |
| Reviewer | Gregory Pierce |
Groovy in Action is a well rounded guide to developing with the Groovy programming language. Anyone with knowledge of programming can pick up this book and become productive fairly quickly. The book assumes some knowledge of Java, but one can suc-cessful comprehend the material without it.
This book should actually be called Groovy: The Definitive Guide as it will work both as an educational text and as a reference book for those developers who adopt Groovy as either a scripting language or as a primary development language for their project. The entirety of the language is covered and sections on frequently debated language fea-tures such as closures are detailed enough to allow the reader to understand the mate-rial even outside of the context of the language.
Chapter 1: Your way to Groovy
Provides an answer the question that is left unanswered by so many technical books and authors - "so what". Discusses many use cases and benefits of Groovy for profes-sional programmers, script writers, and agile or extreme programmers.
Chapter 2: Overture: The Groovy Basics
Discusses the syntax of the groovy programming language and the programming model. It highlights the various integration points for Groovy with Java applications and illustrates key differences between Groovy syntax and Java syntax along with clear ra-tionale for why decisions were made.
Chapter 3: The simple Groovy datatypes
Discusses Groovy's optional type system, defining or overriding operators, the powerful Groovy string and regular expressions library along with how Groovy deals with numeric values. Key benefits of doing certain operations with the GDK (Groovy Development Kit) are highlighted and contrasted with doing the same operation in regular Java code.
Chapter 4: The collective Groovy datatypes
Describes the language concept of ranges and how it solves to various programming problems. Delves into the two primary collective datatypes of Groovy: lists and maps. Also details the interaction with regular Java collection classes
Chapter 5: Working with closures
Starts with a quick introduction to closures to illustrate what problems closures are de-signed to solved. Subsequently it makes a very strong case for closures and provides a considerable number of examples and use cases that clearly illustrate their value.
Chapter 6: Groovy Control Structures
Provides a basic understanding of all of the Groovy control structures such as if, switch, loops, blocks, and exceptions.
Chapter 7: Dynamic object orientation, Groovy style
Discusses the basic of building objects with all of the special features that come along with working with a dynamic language. Features related object oriented programming that are enhanced using a dynamic language are highlighted.
Chapter 8: Working with Builders
Builders are a foreign concept to many Java developers. While many are familiar with the GOF Builder pattern, there are few frameworks out there which really take advan-tage of the pattern like Groovy does. Some of the builders in Groovy such as the SwingBuilder, MarkupBuilder, and AntBuilder illustrate the true power of a builder - take a regular hierarchy of Groovy objects and generate different structures such as Swing interfaces, XML/HTML, or Ant scripts respectively.
Chapter 9: Working with the GDK
The GDK is the Groovy Developers Kit which itself is a combination of the Groovy Stan-dard Libraries and the JDK. There are numerous enhancements to many of the stan-dard JDK classes which clean up their APIs and enhances them for greater productivity. Something that stands out in this chapter is the discussion of Groovlets which is Groovy's extended Servlet API.
Chapter 10: Database Programming with Groovy
Describes the mechanism for integrating with relational databases with Groovy. Dis-cusses the standard method for using JDBC with SQL, the DataSet approach which doesn't use SQL, DataAccessObjects to use the standard Spring integration layer, and the object relational engine GORM.
Chapter 11: Integrating Groovy
This chapter bridges the gap between Groovy and the rest of the world. Many develop-ers will want to use Groovy in different use cases such as an embedded scripting en-gine, a simple shell for executing scripts, integrating with other Java applications in a non-emdedded manner, or just integrating with the Spring 2.0 framework. Whatever your integration need, this chapter describes how that integration should take place and how it should be configured. Of particular mention, the GroovyClassLoader is explained in such fine detail that one can understand the issues involved with integrating Groovy into an application or enterprise container environment.
Chapter 12: Working with XML
To call Groovy's XML parsing abilities inspired would be an understatement. This is one of the areas of Groovy use where you will experience almost instant productivity gains. Reading, processing, and even invoking or hosting web services with Groovy are simple and with all of the various examples in this chapter showing the utility, you may find yourself wondering whether you should even process XML with Java in your next pro-ject.
Chapter 13: Tips and Tricks
This is a fun chapter full of examples of using Groovy for everyday tasks. While you may not find all of these examples practical for your problem domain, they are nonethe-less good use cases for where other people have used Groovy to solve real world prob-lems. Some topics include using Ant with Groovy, writing scripts to automate tasks such as scraping websites, building a code analysis engine with Groovy, etc.
Chapter 14: Unit Testing with Groovy
Testing is an often overlooked discussion point for many frameworks. Many simply refer you to JUnit and expect you to pick up some other reference in order to be productive. The authors of Groovy had testing in mind when they wrote the language and all of this is explained in the Unit Testing chapter. Specific topics about using Groovy to unit test Java code, code coverage, stub and mock objects all give practical examples of where Groovy can be used to solve common problems faced when testing.
Chapter 15: Groovy on Windows
This particular chapter was largely unexpected. Very rarely do you see a book based on Java technologies go out of its way to discuss very platform specific functionality - but in this case it makes a lot of sense because the authors go into detail about an integration point for the Windows platform - scriptcom. With this technology you can use Groovy to control COM and ActiveX objects. So if you desire to create Groovy scripts that can in-teract with Office applications, Windows Media Player, Internet Explorer, etc. this chap-ter gives you the foundation for leveraging your skills in a Windows/.Net world.
Chapter 16: Seeing the Grails Light
This is one of the stranger and unfortunately weaker chapters of Groovy In Action. Grails is an agile framework for building web applications and this chapter hopes to give the reader an introduction to the framework. Unfortunately, the authors chose a weird way of addressing this topic - they treat it as script for a play. This makes the topic very difficult to follow unless you enjoy reading screen plays.
I found this book to be an excellent value. For anyone considering Groovy or even just interested in seeing what all of the fuss is around the features of dynamic languages such as closures, this book will deliver.
The text is very informative and contains clear explanations of all the covered language features.
With books of this type many authors try to cover too much information and are not able to pro-vide enough detail on those topics such that the chapter is essentially wasted. On the other end of the spectrum are authors who try to 'dumb down' the material with trivial impractical examples which ultimately require the reader to purchase another text to really learn the intricacies of the material.
Thankfully the authors don't fall into either of these traps, seemingly refusing to waste the read-ers' time with elementary details that most developers should know. The end result is a well orchestrated, though sometimes quirky, wealth of knowledge that will surely pique the in-terest of all those open to new experiences and bring back the feelings of youthful curiosity from when Java was young.
| Relevance | |
|---|---|
| Readability | |
| Overall | |