View
103
Download
1
Category
Preview:
DESCRIPTION
This is story about thing you wanted to do but didn't yet. We will start with comparison of Groovy and Java code, will see how to test with Groovy and finally will try to sell it to manager
Citation preview
I
Introducing Groovy into Java project
Yuriy Chulovskyy, Luxoft
www.luxoft.com
Yuriy Chulovskyy, 10 years in IT
yuriy.chulovskyy@gmail.com http://www.linkedin.com/in/yuriychulovskyy https://github.com/ychulovskyy
Who am I?
www.luxoft.com
My goals
We can do better!!!
www.luxoft.com
Why Groovy?
www.luxoft.com
Syntax sugar. POJO
61 lines of code
www.luxoft.com
www.luxoft.com
Syntax sugar. POJO
Semicolons
www.luxoft.com
Return statement
www.luxoft.com
public keyword
www.luxoft.com
Verbose setters/getters
www.luxoft.com
37 lines of code
Default implementation for the methods
www.luxoft.com
10 lines of code
www.luxoft.com
Object construction
Object name mentioned in each line
verbose statement
parentheses
www.luxoft.com
www.luxoft.com
www.luxoft.com
www.luxoft.com
Truth
www.luxoft.com
Elvis and null-safe navigation
www.luxoft.com
Collections. List
www.luxoft.com
Collections. List
www.luxoft.com
Collections. List
www.luxoft.com
Collections. HashMap
www.luxoft.com
Patterns. Singleton
www.luxoft.com
Patterns. Immutable
www.luxoft.com
Patterns. Builder
www.luxoft.com
Vice versa
www.luxoft.com
Testing in Groovy.Power asserts
www.luxoft.com
Testing in Groovy.Power asserts
www.luxoft.com
Testing in Groovy.Spock
Defines a Specification with features:setup: or given:expect:when:then:where:
www.luxoft.com
Testing in Groovy.Spock
www.luxoft.com
Testing in Groovy.Spock
www.luxoft.com
Testing in Groovy.Spock
www.luxoft.com
Stream API
www.luxoft.com
Summary.Syntactic Sugar
● Optional: semicolons, parentheses, return keyword, public keyword, typing
● GString● Truth, Elvis, null-safe navigation● Constructor with map as parameter, “with” closure● Collections API● Power asserts
www.luxoft.com
Summary.AST transformation
www.luxoft.com
Summary.Java 8 vs Groovy
www.luxoft.com
Summary.Infrastructure
www.luxoft.com
Links
http://www.groovy-lang.org/
https://speakerdeck.com/glaforge/what-makes-groovy-groovy-jax-london-2013
http://glaforge.appspot.com/article/back-from-javaone
http://www.slideshare.net/aalmiray/gr8conf-groovy-ecosystem
https://github.com/ychulovskyy/TestSpockReportGenerator
www.luxoft.com
Thanks!
Recommended