Learning Groovy (The Book + Code)
Learning Groovy
A guide to learning the popular JVM programming language, Groovy 2.x, and its ecosystem
About the Book
Who is this book for?
Although this book is somewhat intended for those with a Java background, anyone with basic programming skills could benefit from it. This book is a data-filled, yet easy-to-digest tour of the Groovy language and ecosystem. Now at Apress
This book covers:
- Groovy basics, including the GDK
- Advanced Groovy, such as writing Groovy DSLs
- Functional programming in Groovy
- GPars, the built-in concurrency library
- Gradle, the build system
- Grails, the web application framework
- Spock, the testing framework
- Ratpack, the reactive web library
Groovy is a flexible open-source language built for the JVM (Java Virtual Machine) with a Java-like syntax. It can be used dynamically or statically-typed, your choice. It supports functional programming constructs, including first-class functions, currying, and more. It has multiple-inheritance, type inference, and meta-programming.
Groovy is very similar in syntax to Java so it is generally easy for Java developers to learn (Java code is generally valid Groovy code). However, Groovy has many additional features and relaxed syntax rules: closures, dynamic typing, meta-programming (via metaClass), semicolons are optional, regex-support, operator overloading, GStrings, and more. Groovy is interpreted at runtime, but in Groovy 2.0 the ability to compile to byte-code and enforce type-checking were added to the language.
Praise for previous works:
If you're just getting to Java 8, I definitely recommend @adamldavis' book -- very concise and helpful. -Fred Jonsson
"bought both of your books (Modern Java & Modern Programming) and let me tell you, what a great value and extremely good content" - Rozzot
Table of Contents
-
Getting Groovy
-
- About This Book
-
Software to Install
- Java/Groovy
- Others
- Code on Github
-
Groovy 101
- What is Groovy?
- Compact Syntax
- Dynamic Def
- List and Map Definitions
- Groovy GDK
- Everything is an Object
- Easy Properties
- GString
- Closures
- A Better Switch
- Meta-programming
- Static Type Checking
- Elvis Operator
- Safe Dereference Operator
- A Brief History
- Summary
-
Tools
- Console
- Compilation
- Shell
- Documentation
-
GDK
- Collections
- IO
- Ranges
- Utilities
-
Coming from Java
- Default Method Values
- Equals, Hashcode, etc.
- Regex Pattern Matching
- Missing Java Syntax
- Semi-colon Optional
- Where are Generics?
- Groovy Numbers
- Boolean-resolution
- Map Syntax
- Summary
-
-
Advanced Groovy
-
Groovy Design Patterns
- Strategy Pattern
- Meta-programming
- Method Missing
- Delegation
-
DSLs
- Delegate
- Overriding Operators
- Method-missing and Property-missing
-
Traits
- Defining Traits
- Using Traits
- Summary
-
Functional Programming
- Functions and Closures
- Map/Filter/etc.
- Immutability
- Groovy Fluent GDK
- Groovy Curry
- Method Handles
- Tail Recursion
- Summary
-
Groovy GPars
- Parallel Map Reduce
- Actors
-
Groovy Design Patterns
-
The Groovy Ecosystem
-
Groovy Awesomeness
- Web and UI Frameworks
- Cloud Computing Frameworks
- Build Frameworks
- Testing Frameworks/Code Analysis
- Concurrency
- Others
-
Gradle
- Projects and Tasks
- Plugins
- Configuring a Task
- Extra Configuration
- Maven Dependencies
- Gradle Properties
- Multiproject builds
- File Operations
- Exploring
- Summary
-
Grails
- What is Grails?
- Quick Overview of Grails
- Plugins
- REST in Grails
- Short History of Grails
- Testing
- Cache Plugin
- Grails Wrapper
- Cloud
- Groovy Mailgun
-
Spock
- Introduction
- A Simple Test
- Mocking
- Lists or Tables of Data
- Expecting Exceptions
- Conclusion
-
Ratpack
- Script
- Gradle
- Ratpack Layout
- Handlers
- Rendering
- JSON
- Bindings
- Blocking
- Configuration
- Testing
- Summary
-
Groovy Awesomeness
-
Appendixes
- Java/Groovy
- Resources
- Notes
Causes Supported
Oxfam America
Right the Wrong
http://www.oxfamamerica.orgOxfam America is a global organization working to right the wrongs of poverty, hunger, and injustice. We save lives, develop long-term solutions to poverty, and campaign for social change. As one of 17 members of the international Oxfam confederation, we work with people in more than 90 countries to create lasting solutions.
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them