Your SlideShare is downloading. ×
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Groovy and noteworthy
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Groovy and noteworthy

649

Published on

What is Groovy. Why Groovy is an agile dynamic language? What makes Groovy special? Groovy tool set. Getting started from suggestions.

What is Groovy. Why Groovy is an agile dynamic language? What makes Groovy special? Groovy tool set. Getting started from suggestions.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
649
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
7
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Groovy and Noteworthy Izzet Mustafayev@EPAM Systems @webdizz http://webdizz.name
  • 2. Agenda ● Groovy ○ Specials ○ Basics ○ Infrastructure ● Demo ● Getting Started
  • 3. Groovy Specials
  • 4. Groovy is an agile dynamic language
  • 5. ​println 'Hello World​​​​​​​!'​​
  • 6. Java is a Groovy but Groovy is not Java
  • 7. Groovy supports DSL
  • 8. Groovy supports DSL ● A flexible syntax ● Closures ● Meta-programming ● Operator overloading ● No dots and commas
  • 9. Groovy provides statically type check
  • 10. Groovy provides statically type check @groovy.transform.TypeChecked void method() { // do nothing } ​
  • 11. Groovy Basics
  • 12. Groovy Shell
  • 13. Omission of get/set methods ​class Person { String name String email } def person = new Person(name: 'me') person.email = 'email@domain.com' println person.name// me println person.email// email@domain.com ​
  • 14. Initializing beans with named parameters ​class Person { String name String email } def person = new Person(name: 'me') person.email = 'email@domain.com' println person.name// me println person.email// email@domain.com ​
  • 15. Context operations using with class Person { String name String email } def person = new Person(name: 'me', email: 'email@domain.com') person.with{ println name// me println email// email@domain.com }
  • 16. GStrings (interpolation, multiline) def param = 'param' def groovyString = """ There is a ‘${param}’ param """ println groovyString​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​// There is a ‘param’ param
  • 17. Native syntax for data structures def list = [1, 4, 6, 9] println list[-2] // 6 def map = [UA: 'Ukraine', UK: 'United Kingdom'] println map.UA // Ukraine ​def range = 10..20 println range[2] //12 ​
  • 18. Elvis operator for default values def name = null println name != null ? name : "Unknown" // Unknown println name ?: "Unknown" // Unknown name = 'name' println name ?: "Unknown" // name
  • 19. Safe graph navigation if (order != null) { if (order.getCustomer() != null) { if (order.getCustomer().getAddress() != null) { Address address; address = order.getCustomer().getAddress() System.out.println(address); } } } println order?.customer?.address ​
  • 20. Closures printSum = { a, b -> print a+b } printSum(5, 7)// 12 upperCasedList = ['a','b','c','d']. collect{ it.toUpperCase() } println upperCasedList // A, B, C, D ​
  • 21. Metaprogramming String.metaClass.cons2var = { -> String res = '' delegate.toLowerCase() .tokenize('_') .each{ s -> res+=res?s.capitalize():s } res } println "SAMPLE_VAR".cons2var() //sampleVar
  • 22. Groovy Infrastructure
  • 23. Gradle - http://gradle.org/ ● Strong yet flexible conventions ● Manageable and understandable builds ● Follows convention over configuration approach ● Great plug-ins ecosystem
  • 24. Spock - https://github.com/spockframework/spock ● Testing and specification framework ● JUnit compatible ● Highly expressive specification language
  • 25. Easyb - http://easyb.org/ ● Behavior driven development framework ● Specifications are written in Groovy and run via a Java runner, command line, Maven or Ant ● Supports a few different styles of specifications ranging from RSpec's it to a story based DSL with givens, whens, and thens
  • 26. Grails - http://grails.org/ ● Grails is an Open Source, full stack web application framework for the JVM ● Based on Spring, Hibernate, Sitemesh, Quartz etc. ● There are a lot of plug-ins
  • 27. Griffon - http://griffon.codehaus.org ● Desktop development framework inspired in Grails ● Primarily Swing based however supports SWT, Pivot, GTK and JavaFX too ● Growing plugin system (80+ plugins)
  • 28. Gaelyk - http://gaelyk.appspot.com ● Google App Engine development framework based on Groovy and Groovlets ● Emerging plugin system
  • 29. GPars - http://gpars.codehaus.org/ ● Provides DSL and concurrent friendly methods for collections ● Supports Actors and STM ● Dataflow concurrency model
  • 30. CodeNarc - http://codenarc.sourceforge.net/ ● Static analysis for Groovy code ● Over 175 rules to detect defects, bad practices, style issues etc. ● Build tools and Sonar integration
  • 31. GVM - http://gvmtool.net/ ● Manages parallel Versions of multiple SDKs ● Convenient command line interface ● Inspired by RVM ● Supports Groovy, Grails, Gradle etc ● Unfortunately does not work for Win
  • 32. GroovyServ - http://kobo.github.io/groovyserv/ ● Improves Groovy’s startup time ● Works for Win
  • 33. Getting Started
  • 34. http://groovy.codehaus.org/
  • 35. Groovy in Action* by Dierk König ● Groovy committer since 2004 ● Frequent conference speaker ● Contributor to several agile and testing books
  • 36. Programming Groovy 2 by Venkat Subramaniam ● An award-winning author ● Famous Agile Guru ● Frequent conference speaker
  • 37. Thank You! Groovy and Noteworthy Izzet Mustafayev@EPAM Systems @webdizz http://webdizz.name

×