Java Reference
In-Depth Information
Use Java where Java works well, and use Groovy where it makes your life easier. Nobody
is ever going to rewrite, say, the Spring Framework, in Groovy. There's no need. Groovy
works beautifully with Spring, as I'll discuss in detail in chapter 7 . Likewise, the JVM is
everywhere. That's a good thing, because wherever Java can run, so can Groovy, as shown
in figure 1.1 .
Figure 1.1. Groovy generates bytecodes for the Java Virtual Machine. Either compile them ahead of time or let the
groovy command generate them from source.
I'll discuss the practical details in the next chapter, but at its base Groovy is Java. Groovy
scripts and classes compile to bytecodes that can be freely intermixed with compiled Java
classes.Fromaruntimepointofview,runningcompiledGroovymeansjustaddingasingle
JAR file to your environment.
One of the goals of this topic is to identify opportunities where Groovy can significantly
help Java developers. To do that, let me first review where Java might have some issues
that need help.
1.1. Issues with Java
A perfect storm swept through the development world in the mid- to late-1990s, which ul-
timately resulted in moving the primary development language from C++ to Java. Java is
effectively the next-generation language in the C++ family. Its syntax shares much in com-
 
Search WWH ::




Custom Search