Date post: | 27-May-2015 |
Category: |
Technology |
Upload: | zalan-borsos |
View: | 208 times |
Download: | 2 times |
© Catalysts GmbH
© Catalysts GmbH
Magic with Groovy & GrailsThe Search is over
Zalán Borsos
© Catalysts GmbH
What is Groovy?• Dynamic language• 1.0 released on 02.01.2007• Dynamically compiled to JVM bytecode• 99% of Java code is also valid• Groovy = Java +
dynamic typing +
additional methods & operators +
closures
© Catalysts GmbH
If we indent code properly,why do we need semicolons?
© Catalysts GmbH
Dynamic TypingJavaArrayList<String> list = new ArrayList<String>() {
{add("A");add("B");add("C");
}};
HashMap<Integer, String> map = new HashMap<Integer, String>() {
{put(1, "A");put(2, "B");put(3, "C");
}};
Groovy
?
© Catalysts GmbH
Additional Operators• Spread *.• Elvis ?:• Safe navigation ?.• Equals ==
© Catalysts GmbH
Closures“A Groovy Closure is like a ‘code block’ or a method pointer. It is a piece of code that is defined and then executed at a later point.”
http://groovy.codehaus.org/Closures
© Catalysts GmbH
Functional Programming• Closures as functions• Closures as function compositions• Fibonacci
© Catalysts GmbH
What is Grails?• Web application framework• Convention over consideration• Spring MVC• Fast prototyping and development
© Catalysts GmbH