SlideShare une entreprise Scribd logo
1  sur  77
WHY
GROOVY
IS
SO
AWESOME   Chris Trevino
“Using a computer requires a fair amount of
ritual and ceremony…The less you interact
with your computer, the faster you can go.
In other words, eliminating ceremony allows
you to get to the essence of the problem.”

             Neal Ford – The Productive Programmer
About Groovy

•Object-oriented
•Dynamically Typed
•Can use all Java libraries
•Feels a lot like Java
•Can be compiled or interpreted
Groovy Learning Curve
Most Java is valid Groovy
Steps to Start Using Groovy

1) Install eclipse plugin
2) Add groovy nature
3) Rename .java file .groovy
AWESOME
THINGS
Semicolons are Optional
Semicolons are Optional
‘public’ is Optional
‘public’ is Optional
You don’t use package protected anyway
You don’t use package protected anyway


     (@PackageScope annotation is available if you do)
‘.class’ is Optional
‘.class’ is Optional
Getters and Setters are Optional
Getters and Setters are Optional
Getters and Setters are Optional
get..() and set..() are Optional
Lamdba Expressions
AWESOMENESS
SO FAR
MORE
AWESOME
THINGS
Cleaned up Imports
Cleaned up Imports
Type Declarations are Optional
‘return’ is Optional
Streamlined Lists
Streamlined Lists
Streamlined Maps
Streamlined Maps
Streamlined Bean Instantiation
Safe Traversal
Elvis
LIST
COMPREHENSIONS
G-Strings
Native Regex Support




  Match: ==~
  Find: =~
Easy File I/O
Easy Markup
Missing Method/Property Handling
Categories / Extension Methods
Extension methods with metaClass
Type Renaming
Hella Dynamic
Hella Dynamic
Hella Static


Groovy++ =>
GROOVY
PLAYS
NICE
Groovy brownbag

Contenu connexe

Similaire à Groovy brownbag

Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Yasuharu Nakano
 

Similaire à Groovy brownbag (20)

Towards a responsive business - DevOps MeetUp Melbourne 2013
Towards a responsive business - DevOps MeetUp Melbourne 2013Towards a responsive business - DevOps MeetUp Melbourne 2013
Towards a responsive business - DevOps MeetUp Melbourne 2013
 
Core Java interview questions-ppt
Core Java interview questions-pptCore Java interview questions-ppt
Core Java interview questions-ppt
 
Feelin' Groovy: An Afternoon of Reflexive Metaprogramming
Feelin' Groovy: An Afternoon of Reflexive MetaprogrammingFeelin' Groovy: An Afternoon of Reflexive Metaprogramming
Feelin' Groovy: An Afternoon of Reflexive Metaprogramming
 
Generalization in Auto-Testing. How we put what we had into new Technological...
Generalization in Auto-Testing. How we put what we had into new Technological...Generalization in Auto-Testing. How we put what we had into new Technological...
Generalization in Auto-Testing. How we put what we had into new Technological...
 
Feelin' Groovy: A Groovy Developer in the Java World
Feelin' Groovy: A Groovy Developer in the Java WorldFeelin' Groovy: A Groovy Developer in the Java World
Feelin' Groovy: A Groovy Developer in the Java World
 
3 blades webinar dec 12 deploying deep learning models to production
3 blades webinar dec 12   deploying deep learning models to production3 blades webinar dec 12   deploying deep learning models to production
3 blades webinar dec 12 deploying deep learning models to production
 
GoLang - Why It Matters
GoLang -  Why It MattersGoLang -  Why It Matters
GoLang - Why It Matters
 
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
 
Acceptance testing with Geb
Acceptance testing with GebAcceptance testing with Geb
Acceptance testing with Geb
 
All of Javascript
All of JavascriptAll of Javascript
All of Javascript
 
WebGL Camp 4 - A3 3D Engine
WebGL Camp 4 - A3 3D EngineWebGL Camp 4 - A3 3D Engine
WebGL Camp 4 - A3 3D Engine
 
Spring-batch Groovy y Gradle
Spring-batch Groovy y GradleSpring-batch Groovy y Gradle
Spring-batch Groovy y Gradle
 
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1
 
Groovy Metaprogramming for Dummies
Groovy Metaprogramming for DummiesGroovy Metaprogramming for Dummies
Groovy Metaprogramming for Dummies
 
Java OOP s concepts and buzzwords
Java OOP s concepts and buzzwordsJava OOP s concepts and buzzwords
Java OOP s concepts and buzzwords
 
Better Swift from the Foundation up #tryswiftnyc17 09-06
Better Swift from the Foundation up #tryswiftnyc17 09-06Better Swift from the Foundation up #tryswiftnyc17 09-06
Better Swift from the Foundation up #tryswiftnyc17 09-06
 
Introduction to Deep Learning with Will Constable
Introduction to Deep Learning with Will ConstableIntroduction to Deep Learning with Will Constable
Introduction to Deep Learning with Will Constable
 
CS8392 OOP
CS8392 OOPCS8392 OOP
CS8392 OOP
 
oop unit1.pptx
oop unit1.pptxoop unit1.pptx
oop unit1.pptx
 
U1 JAVA.pptx
U1 JAVA.pptxU1 JAVA.pptx
U1 JAVA.pptx
 

Dernier

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Dernier (20)

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Groovy brownbag

Notes de l'éditeur

  1. Welcome!I am Chris, and we’re talking about Groovy * Wrote a groovy coral service * Wrote GroovyTrailsMy Goals * Not to cover all aspects of Groovy * Not to convince you to port all of our code * Amuse bouche into the language * Convince you that it’s a good complement to Java
  2. The paradox of productivity.
  3. * You can incorporate groovy idioms as you ramp up.* You can cherry pick what parts you want
  4. Groovy is incredibly easy to learn. * Very java-ish compared to other alternative languages. * My experience was that it took almost no time to learn. * Doesn’t require reading a book or learning a new paradigm.
  5. * You can incorporate groovy idioms as you ramp up.* You can cherry pick what parts you want
  6. Package protected is rarely used, but an annotation is available.Public and private are most common.
  7. Package protected is rarely used, but an annotation is available.Public and private are most common.
  8. Package protected is rarely used, but an annotation is available.Public and private are most common.
  9. Great for one-off callbacks with frameworks (JdbcTemplates, PreparedStatementCreator, runnables, etc..)
  10. So here’s what we started with – pretty vanilla java
  11. And we’ve turned it into a trivial amount of code
  12. Everything in java.util is imported by default, so you won’t accidentally include emory lists or something.
  13. Everything in java.util is imported by default, so you won’t accidentally include emory lists or something.
  14. You can use def for defining variables, meaning you don’t have to type class names twice.
  15. Excluding return can clean up simple properties and calculations. For larger methods I find that it improves readability to leave them in.
  16. Simplified collection construction, very nice!
  17. Simplified collection construction, very nice!
  18. Simplified collection construction, very nice!
  19. Simplified collection construction, very nice!
  20. Instead of calling setX, setY, we have a nice way of setting bean properties.Great for simple DI and test construction.
  21. Each – you want to do something over every item in a list
  22. INJECT!
  23. This is what they’re actually called.Removes a lot of ugly code involving string concatenation with plusses, or String.format.
  24. Feeds the next example
  25. From actual service code.Converting from transport objects to a persisted domain modelPreviously had about 15 lines of anonymous class implementations calling different overloadsOne lambda to rule them all, dynamic multicastWhich is…
  26. Defs become implicit.Better compile-time support, loss of dynamicismSpeed parity with Java for performance-sensitive codeAlso addsTraits