Learning Groovy by Adam L. Davis

By Adam L. Davis

Start construction strong apps that benefit from the dynamic scripting features of the Groovy language. This e-book covers Groovy basics, similar to fitting Groovy, utilizing Groovy instruments, and dealing with the Groovy improvement package (GDK). you are going to additionally study extra complicated points of Groovy, corresponding to utilizing Groovy layout styles, writing DSLs in Groovy, and profiting from Groovy's practical programming features.

There is extra to Groovy than the center language, so Learning Groovy covers the prolonged Groovy environment. you will see the way 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 are going to learn

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

Who is that this ebook for
Although this booklet is meant for people with a Java heritage, somebody with uncomplicated programming talents may benefit from it. This e-book is a data-filled, but easy-to-digest travel of the Groovy language and surroundings.

Show description

Read or Download Learning Groovy PDF

Best compilers books

Programming in Prolog

Initially released in 1981, this used to be the 1st textbook on programming within the Prolog language and continues to be the definitive introductory textual content on Prolog. even though many Prolog textbooks were released for the reason that, this one has withstood the try of time as a result of its comprehensiveness, instructional strategy, and emphasis on common programming purposes.

XML and Web Technologies for Data Sciences with R (Use R!)

Internet applied sciences are more and more correct to scientists operating with info, for either getting access to info and developing wealthy dynamic and interactive displays.  The XML and JSON info codecs are usual in net prone, typical websites and JavaScript code, and visualization codecs similar to SVG and KML for Google Earth and Google Maps.

Additional resources for Learning Groovy

Example text

It will infer types for you, so your code can still be Groovy. It infers the Lowest Upper Bound (LUB) type based on your code. * @TypeChecked class Foo { int i = 42 // this works fine } new Foo() ■ Gotcha’s • Runtime meta-programming won't work! toUpperCase()} If you add the @CompileStatic annotation to your class or method, it causes the compiler to compile your Groovy code to byte-code. This would be useful when you have code that needs to be extremely performant or you need Java byte-code for some other reason.

1007/978-1-4842-2117-4_9 45 CHAPTER 9 ■ FUNCTIONAL PROGRAMMING If a closure has one argument, it can be referenced as it in Groovy. For example: 1 def ■ closr = {it + 1} Tip In Groovy, the return keyword can be omitted if the returned value is the last expression. Using Closures When a closure is the last or only parameter to a method it can go outside of the parentheses. For example, the following defines a method that takes a list and a closure for filtering items: 1 2 3 4 def find(list, tester) { for (item in list) if (tester(item)) return item } This method returns the first item in the list for which the closure returns true.

27 PART II Advanced Groovy Beyond the basics, Groovy is a rich tapestry of language features. 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.

Download PDF sample

Rated 4.08 of 5 – based on 44 votes