confessions of a java developer that fell in love with the groovy language

42
Confessions of a Java developer who fell in love with the Groovy language Victor Trakhtenberg [email protected] @victortr75

Upload: victor-trakhtenberg

Post on 12-Apr-2017

592 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Confessions of a java developer that fell in love with the groovy language

Confessions of a Java developer

who fell in love with the Groovy language

Victor Trakhtenberg

[email protected] @victortr75

Page 2: Confessions of a java developer that fell in love with the groovy language

Personal

My name is Victor

Page 3: Confessions of a java developer that fell in love with the groovy language

Personal

Java.IL community co-founder

http://www.meetup.com/JavaIL/

Page 4: Confessions of a java developer that fell in love with the groovy language

Full Stack Engineer @

http://commercesciences.com/jobs

Page 5: Confessions of a java developer that fell in love with the groovy language

WeCode-IL

code with us!!

http://www.meetup.com/WeCode-IL/

Page 6: Confessions of a java developer that fell in love with the groovy language
Page 7: Confessions of a java developer that fell in love with the groovy language
Page 8: Confessions of a java developer that fell in love with the groovy language
Page 9: Confessions of a java developer that fell in love with the groovy language

Groovy language concepts

• Dynamic language• with optional static-typing and static-

compilation• Closures• Functional programming• Meta-programming• Traits• DSLs • and more…

Page 10: Confessions of a java developer that fell in love with the groovy language

Groovy Features

• Strings• Collections• Date• Parsing and producing

JSON• Working with a DB• Processing XML• Template engines

• Builders• Grapes• Traits• Processing

configuration• HTTPBuilder• and many more…

Page 11: Confessions of a java developer that fell in love with the groovy language

Groovy History• 2003 – A dynamic language for the JVM (community commits

– 100%)• 2007 – Groovy 1.0• 2008 – G2One era (G2One -> SpringSource -> VMWare ->

Pivotal)• 2011 – Time to move to GitHub• 2012 – Groovy 2 and static compilation (community commits

– 63%)• 2014 – Android support • 2015 – End of Pivotal sponsorship + Apache foundation

http://melix.github.io/blog/2015/02/who-is-groovy.html

Page 12: Confessions of a java developer that fell in love with the groovy language
Page 13: Confessions of a java developer that fell in love with the groovy language

Prelude - REPL

Page 14: Confessions of a java developer that fell in love with the groovy language

Groovy Strings

Page 15: Confessions of a java developer that fell in love with the groovy language

Strings

Page 16: Confessions of a java developer that fell in love with the groovy language

Groovy Collections

Page 17: Confessions of a java developer that fell in love with the groovy language

Collections

Page 18: Confessions of a java developer that fell in love with the groovy language

Collections - cont.

Page 19: Confessions of a java developer that fell in love with the groovy language

Map with default

Page 20: Confessions of a java developer that fell in love with the groovy language

Groovy Date

Page 21: Confessions of a java developer that fell in love with the groovy language

Dates: it’s easy!!

Page 22: Confessions of a java developer that fell in love with the groovy language

TimeDuration + TimeCategory

Page 23: Confessions of a java developer that fell in love with the groovy language

Personal Experience

Page 24: Confessions of a java developer that fell in love with the groovy language

Using Groovy in a running Java project

Our setup: Java Play! Framework project

Choose one concern to use Groovy

Our choice: JSON manipulations

Page 25: Confessions of a java developer that fell in love with the groovy language

Parse JSON

Page 26: Confessions of a java developer that fell in love with the groovy language

Build JSON

Page 27: Confessions of a java developer that fell in love with the groovy language

Case Study: Campaign Configuration Management

Page 28: Confessions of a java developer that fell in love with the groovy language

Is it a ‘coupon’ campaign

Page 29: Confessions of a java developer that fell in love with the groovy language

Integrate with Salesforce

Page 30: Confessions of a java developer that fell in love with the groovy language

Update account at Salesforce

Page 31: Confessions of a java developer that fell in love with the groovy language

Integrate with Salesforce - Authenticate

Page 32: Confessions of a java developer that fell in love with the groovy language

Groovy SQL

Page 33: Confessions of a java developer that fell in love with the groovy language

DB Table to CSV

Page 34: Confessions of a java developer that fell in love with the groovy language
Page 35: Confessions of a java developer that fell in love with the groovy language

Groovy + MongoDB = gmongo

Page 36: Confessions of a java developer that fell in love with the groovy language

Use Groovy for non-production

Page 37: Confessions of a java developer that fell in love with the groovy language

Spock – Data Tables

Page 38: Confessions of a java developer that fell in love with the groovy language

http://jaxenter.com/groovy-is-the-swift-alternative-for-android-107846.html

Page 39: Confessions of a java developer that fell in love with the groovy language

Groovy resources• http://groovy-lang.org/• http://glaforge.appspot.com/category/Groovy%20Weekly• http://www.mrhaki.com/• https://plus.google.com/communities/105160926044623621768• http://www.mscharhag.com/2015/02/creating-android-apps-with-groovy.html• https://dzone.com/articles/groovys-smooth-operators• http://groovy.codehaus.org/modules/http-builder/doc/uribuilder.html• http://www.drdobbs.com/jvm/why-build-your-java-projects-with-gradle/

240168608?pgno=3• http://www.infoq.com/presentations/groovy-test-java-spock• http://www.infoq.com/presentations/testing-spock-geb• http://melix.github.io/blog/2015/02/who-is-groovy.html• http://groovy-the-superb-homeless.mally.pl/#/• https://github.com/victorgit/GroovyPresentation

Page 40: Confessions of a java developer that fell in love with the groovy language

MrHaki – Groovy Goodness

http://mrhaki.blogspot.co.il/2009/09/groovy-goodness-padding-strings.html

Page 41: Confessions of a java developer that fell in love with the groovy language
Page 42: Confessions of a java developer that fell in love with the groovy language

Images sources• http://www.clevercuties.com/myimages/products/Computers/IHEARTPROGRAMMING.jpg• http://blogs.perceptionsystem.com/wp-content/uploads/2013/12/Happy-Customer.jpg• http://lifepalette.com/wp-content/uploads/2015/01/Productivity.jpg• http://www.checkaction.com/blog/wp-content/uploads/2014/01/startup-employee-productivity-tips-675x320.jpg• http://www.akifarslan.com.tr/wp-content/uploads/2013/10/java.jpg• http://cdn.makeuseof.com/wp-content/uploads/2012/03/jvm.png?84ec63• http://cdn.slidesharecdn.com/ss_thumbnails/ecosystem-120717081103-phpapp01-thumbnail-4.jpg?cb=1342530724• http://www.army-armee.forces.gc.ca/assets/ARMY_Internet/images/ceremonial-guard/index-main.jpg• http://www.local-guru.net/img/guru/have_fun.png• http://blog.xo.com/wp-content/uploads/2014/03/pic-raised-hands-550x300.png• https://pbs.twimg.com/media/BVDKBfUCIAAWKw9.jpg• http://www.nscsd.org/webpages/jenkondrk/imageGallery/Clip%20art/raise%20hand.gif• http://ubik.cc/MAOW-Firenze-09/images/repl-loop.png• http://hirportal.sikerado.hu/images/kep/201110/belyeg.jpg• http://www.slideshare.net/SpringCentral/groovy-in-thelightofjava8• http://blog.cacoethes.co.uk/groovyandgrails/groovy-in-light-of-java-8• http://www.infoq.com/articles/groovy-to-Java-8• https://tedvinke.wordpress.com/2014/06/20/java-8-lambdas-vs-groovy-closures-compactness-grouping-and-summing/• http://groovy.mn/static/hh97hMrFEv8Xc9j1zvR9winGH86xmHGbiZNKFTORWYl.jpg• http://4.bp.blogspot.com/-eHpEiIM6Nss/VRs-EqQjzYI/AAAAAAAATSo/tpEFUn3QrZY/s1600/SQL-Server.png• http://www.kittenswhiskers.com/wp-content/uploads/sites/48/2014/02/fun-with-yarn-640x422.jpg