SlideShare a Scribd company logo
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

More Related Content

Similar to 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
 

Similar to 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
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 

Groovy brownbag

Editor's Notes

  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