By Adam L. Davis

Start development robust apps that make the most of the dynamic scripting functions of the Groovy language. This booklet covers Groovy basics, resembling fitting Groovy, utilizing Groovy instruments, and dealing with the Groovy improvement equipment (GDK). you are going to additionally study extra complex facets of Groovy, similar to utilizing Groovy layout styles, writing DSLs in Groovy, and making the most of Groovy's sensible programming features.

There is extra to Groovy than the center language, so Learning Groovy covers the prolonged Groovy atmosphere. you will see tips to harness Gradle (Groovy's construct system), Grails (Groovy's internet program framework), Spock (Groovy's checking out framework), and Ratpack (Groovy's reactive internet library).

What you will learn

  • Groovy basics, together with the GDK or Groovy improvement Kit
  • Advanced Groovy, comparable to writing Groovy DSLs
  • Functional programming in Groovy
  • GPars, the integrated concurrency library
  • Gradle, the construct system
  • Grails, the net program framework
  • Spock, the trying out framework
  • Ratpack, the reactive net library

Who is that this booklet for
Although this booklet is meant for people with a Java historical past, someone with uncomplicated programming abilities may gain advantage from it. This publication is a data-filled, but easy-to-digest travel of the Groovy language and atmosphere.

Show description

Read Online or Download Learning Groovy PDF

Best compilers books

Joel on Software: And on Diverse and Occasionally Related Matters That Will Prove of Interest to Software Developers, Designers, and Managers, and to Those Who, Whether by Good Fortune or Ill Luck, Work with Them in Some Capacity

Joel Spolsky begun his mythical net log, www. joelonsoftware. com, in March 2000, as a way to provide insights for making improvements to the realm of programming. Spolsky dependent those observations on years of private adventure. the outcome only a handful of years later? Spolsky's technical wisdom, caustic wit, and outstanding writing talents have earned him prestige as a programming guru!

From Linear Operators to Computational Biology Essays in Memory of Jacob T. Schwartz

Foreword. - advent. - Nature as Quantum computing device. - Jack Schwartz Meets Karl Marx. - SETL and the Evolution of Programming. - determination approach for effortless Sublanguages of Set conception XVII: as a rule happening Decidable Extensions of Multi-level Syllogistic. - Jack Schwartz and Robotics: The Roaring Eighties.

Principles of Compilers: A New Approach to Compilers Including the Algebraic Method

"Principles of Compilers: a brand new method of Compilers together with the Algebraic process" introduces the information of the compilation from the traditional intelligence of humans through evaluating similarities and transformations among the compilations of traditional languages and programming languages. The notation is created to checklist the resource language, goal languages, and compiler language, vividly illustrating the multilevel method of the compilation within the strategy.

Formal Techniques for Safety-Critical Systems: Third International Workshop, FTSCS 2014, Luxembourg, November 6-7, 2014. Revised Selected Papers

This publication constitutes the refereed complaints of the 3rd overseas Workshop on Formal recommendations for Safety-Critical structures, FTSCS 2014, held in Luxembourg, in November 2014. The 14 revised complete papers provided including invited talks have been rigorously reviewed and chosen from forty submissions.

Extra resources for Learning Groovy

Example text

Each—Iterates through the values using the given closure. • eachWithIndex—Iterates through with two parameters: a value and an index. • find – Finds the first element that matches a closure. • findIndexOf—Finds the first element that matches a closure and returns its index. • any—True if any element returns true for the closure. • every—True if all elements return true for the closure. • reverse—Reverses the ordering of elements in a list. • first—Gets the first element of a list. • last—Returns the last element of a list.

141592d Exercise Try multiplying different number types and determining the class of the result. Boolean-Resolution Since Groovy is very similar to Java, but not Java, it's easy to get confused by the differences. A couple of the areas of confusion are boolean-resolution (also called “Groovy truth”) and the Map syntax sugar. 26 CHAPTER 5 ■ COMING FROM JAVA Groovy is much more liberal in what it accepts in a Boolean expression. For example, an empty string and a zero are considered false. "") println("true") (42) println("true") (!

It can be used dynamically or statically-typed; it’s your choice. It supports functional programming constructs, including first-class functions, currying, and more. It has multiple-inheritance, type inference, and meta-programming. CHAPTER 6 Groovy Design Patterns Design patterns are a great way to make your code functional, readable, and extensible. There are some patterns that are easier and require less code in Groovy compared to Java. Strategy Pattern Imagine you have three different methods for finding totals: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 def totalPricesLessThan10(prices) { int total = 0 for (int price : prices) if (price < 10) total += price total } def totalPricesMoreThan10(prices) { int total = 0 for (int price : prices) if (price > 10) total += price total } def totalPrices(prices) { int total = 0 for (int price : prices) total += price total } A lot of code is duplicated in this case.

Download PDF sample

Learning Groovy by Adam L. Davis
Rated 4.36 of 5 – based on 50 votes