Programming Groovy 2
Groovy brings you the best of both worlds: a flexible, highly productive, agile, dynamic language that runs on the rich framework of the Java Platform. Groovy preserves the Java semantics and extends the JDK to give you true dynamic language capabilities. Programming Groovy 2 will help you, the experienced Java developer, learn and take advantage of the latest version of this rich dynamic language. You’ll go from the basics of Groovy to the latest advances in the language, including options for type checking, tail-call and memoization optimizations, compile time metaprogramming, and fluent interfaces to create DSLs.
You don’t have to leave the rich Java Platform to take advantage of Groovy. Groovy preserves Java’s semantics and extends the JDK, so programming in Groovy feels like the Java language has been augmented; it’s like working with a lighter, more elegant Java. If you’re an experienced Java developer who wants to learn how Groovy works, you’ll find exactly what you need in this book.
You’ll start with the fundamentals of programming in Groovy and how it works with Java, and then you’ll explore advanced concepts such as unit testing with mock objects, using Builders, working with databases and XML, and creating DSLs. You’ll master Groovy’s powerful yet complex run-time and compile-time metaprogramming features.
Much has evolved in the Groovy language since the publication of the first edition of Programming Groovy. Programming Groovy 2 will help you learn and apply Groovy’s new features. Creating DSLs is easier now, and Groovy’s already-powerful metaprogramming facilities have improved even more. You’ll see how to work with closures, including tail call optimization and memoization. The book also covers Groovy’s new static compilation feature.
Whether you’re learning the basics of the language or interested in getting proficient with the new features, Programming Groovy 2 has you covered.
What You Need
To work on the examples in the book you need Groovy 2.0.5 and Java JDK 5 or higher.
Table of Contents
Part I: Beginning Groovy
Chapter 1. Getting Started
Chapter 2. Groovy for Java Eyes
Chapter 3. Dynamic Typing
Chapter 4. Using Closures
Chapter 5. Working with Strings
Chapter 6. Working with Collections
Part II: Using Groovy
Chapter 7. Exploring the GDK
Chapter 8. Working with XML
Chapter 9. Working with Databases
Chapter 10. Working with Scripts and Classes
Part III: MOPping Groovy
Chapter 11. Exploring Metaobject Protocol (MOP)
Chapter 12. Intercepting Methods Using MOP
Chapter 13. MOP Method Injection
Chapter 14. MOP Method Synthesis
Chapter 15. MOPping Up
Chapter 16. Applying Compile-Time Metaprogramming
Part IV: Using Metaprogramming
Chapter 17. Groovy Builders
Chapter 18. Unit Testing and Mocking
Chapter 19. Creating DSLs in Groovy
Appendix A1. Web Resources
Appendix A2. Bibliography
Book Details
- Paperback: 370 pages
- Publisher: Pragmatic Bookshelf; 2nd Edition (July 2013)
- Language: English
- ISBN-10: 1937785300
- ISBN-13: 978-1937785307