groovy for java developers

17
© 2014 SpringOne 2GX. All rights reserved. Do not distribute without permission. Groovy for Java developers Peter Ledbrook w: http://www.cacoethes.co.uk/ e: [email protected] t: @pledbrook

Upload: spring-io

Post on 14-Jun-2015

1.217 views

Category:

Software


0 download

DESCRIPTION

Java is a good all-purpose programming language, but does that mean it's the best tool for all jobs?

TRANSCRIPT

Page 1: Groovy for Java Developers

© 2014 SpringOne 2GX. All rights reserved. Do not distribute without permission.

Groovy for Java developersPeter Ledbrook

w: http://www.cacoethes.co.uk/ e: [email protected] t: @pledbrook

Page 2: Groovy for Java Developers

To answer the question…

2

Page 3: Groovy for Java Developers

3

Why would you use a language called Groovy?

Page 4: Groovy for Java Developers

Background

4

Page 5: Groovy for Java Developers

OO language for the JVM

Java-like syntax

Optional types

Dynamic or Static - your choice!

Simple & expressive

What is Groovy?

5

Page 6: Groovy for Java Developers

Groovy Source

Java Byte Code

JVM

Compilation

java -cp groovy-all-2.3.0.jar …

Groovy is compiled

6

Page 7: Groovy for Java Developers

Groovy Source

Java Byte Code

JVM

Compilation

java -cp groovy-all-2.3.0.jar …

Groovy is compiled

7

Just add Groovy JAR to your classpath

Page 8: Groovy for Java Developers

http://groovyconsole.appspot.com/

How do you use it?

8

Page 9: Groovy for Java Developers

How do you use it?

9

Download Groovy development kit (GDK)

Install

groovy, groovyConsole, groovysh

http://groovy.codehaus.org/Download

Page 10: Groovy for Java Developers

How do you use it?

10

Install msysgit

Install GVM

gvm install groovy 2.2.2

http://gvmtool.net/

(Windows only)

Run as Administrator

Page 11: Groovy for Java Developers

How do you use it?

11

Page 12: Groovy for Java Developers

Demo

12

Page 13: Groovy for Java Developers

In summary

• Great for cross-platform scripting

• Ideal for tests

• Seamless integration with Java

• Solid for application development

13

Page 14: Groovy for Java Developers

A great ecosystem!

14

Geb

SpockGVM

Ratpack

Page 15: Groovy for Java Developers

Groovy on Android

15

+

=

http://melix.github.io/blog/2014/06/grooid.html

Page 16: Groovy for Java Developers

More info

• Docs: http://groovy-lang.org/docs/groovy-2.3.3/html/

documentation/

• Groovy JDK: http://groovy-lang.org/docs/groovy-2.3.3/html/

groovy-jdk/

• Groovy Koans: http://groovykoans.org/

16

Page 17: Groovy for Java Developers

17

Thank you!