SlideShare une entreprise Scribd logo
1  sur  121
Télécharger pour lire hors ligne
1. Funny Puzzling
questions
2. You think and vote
3. Lots of T-shirts flying
in the air
4. Official twitter handle!
groovypuzzlers
5. Two entertaining guys on
stage
Cédric?!
-3.abs()
(-3).abs()
int value = -3
value.abs()
println (-3).abs()
-3
Caught: java.lang.NullPointerException: Cannot invoke method abs() on null object
java.lang.NullPointerException: Cannot invoke method abs() on null object
at AbsolutelyGroovy.run(AbsolutelyGroovy.groovy:7)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
println (-3).abs()
“All problems in computer science can be
solved by another pair of parentheses”
John McCarthy, the inventor of LISP
println ((-3).abs())
int value = -3
println value.abs()
def range = 1.0..10.0
assert range.contains(5.0)
println range.contains(5.6)
Iterator iterator = (1.0..10.0).iterator()
while (iterator.hasNext()) {
print "${iterator.next()} "
}
1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0
def key = 'x'
def map = [key: 'treasure']
def value = map.get(key)
println value
def key = 'x'
def map = [key: 'treasure']
def value = map.get(key)
println value
1.def map = [(key): 'treasure']
2.map.put(key, 'treasure')
3.map."$key" = 'treasure'
4.map[key] = 'treasure'
def map = [2: 'treasure']
def key = 2
def value = map."$key"
println value
def map = [2: 'treasure']
def key = 2
def value = map."$key"
println value
def map = [2: 'treasure']
println map.keySet().first().class.name
java.lang.Integer
List<Integer> list = [1,2,3]
def now = new Date()
list << now
println list
List<Integer> list = [1,2,3]
def now = new Date()
list << now
println list
List<Integer> list = [1,2,3]
def now = new Date()
list << now
list << 'foo'
println list*.class.name
[java.lang.Integer, java.lang.Integer,
java.lang.Integer, java.util.Date,
java.lang.String]
def map = [metaClass: ]
println "What's the $map.metaClass, Andres?"
map.metaClass
map.get('metaClass')
map.getMetaClass()
[0..9].each { println(it - 1) }
boolean isPrime(def x) {
if (x == 2) return true
int limit = Math.sqrt(x) + 1
(2..limit).each {
if (x % it == 0) {
return false
}
}
true
}
println isPrime("4" as Double)
boolean isPrime(def x) {
if (x == 2) return true
int limit = Math.sqrt(x) + 1
(2..limit).each {
if (x % it == 0) {
return false
}
}
true
}
println isPrime("4" as Double)
boolean isPrime(def x) {
if (x == 2) return true
int limit = Math.sqrt(x) + 1
(2..limit).each {
if (x % it == 0) {
return false
}
}
true
}
println isPrime("4" as Double)
http://kousenit.wordpress.com/2014/04/18/responses-to-the-
closure-of-no-return/
class VanHalen {
public static jump() {
"Here are the ${lyrics()}"
}
def methodMissing(String name, def args) {
'lyrics'
}
}
println VanHalen.jump()
class VanHalen {
public static jump() {
"Here are the
${lyrics()}"
}
def
methodMissing(String name,
def args) {
'lyrics'
}
}
println VanHalen.jump()
class VanHalen {
public static jump() {
"Here are the ${lyrics()}"
}
static $static_methodMissing(String name, def args) {
'lyrics'
}
}
println VanHalen.jump()
class VanHalen {
public jump() {
"Here are the ${lyrics()}"
}
def methodMissing(String name, def args) {
'lyrics'
}
}
println new VanHalen().jump()
double value = 3
println "$value.14".isDouble()
double value = 3
println "$value.14".isDouble()
class Invite {
int attending = 1
}
def invite = new Invite()
def attendees = (invite.attending) +1
println attendees
class Invite {
int attending = 1
}
def invite = new Invite()
def attendees = (invite.attending) +1
println attendees
def attendees = (new
Invite().attending) + 1
println attendees
def invite = new Invite()
println (invite.attending +1)
1. Write readable code
2. Comment neat tricks
3. Sometimes it is just a bug
4. Use static code analysis
(intellij IDEA!)
5. Rtfm
6. Don’t code like my brother
We have just started!
(may end up in proper
overalls)
Puzzlers? Gotchas? Fetal
position inducing behavior?
- puzzlers jfrog.com
- Groovypuzzlers
Positive feedback?
Praise us on twitter
groovypuzzlers
- aalmiray
- jbaruch
Negative feeback?
/dev/null
The groovy puzzlers (as Presented at Gr8Conf US 2014)

Contenu connexe

Tendances

dplyr and torrents from cpasbien
dplyr and torrents from cpasbiendplyr and torrents from cpasbien
dplyr and torrents from cpasbienRomain Francois
 
Declare Your Language: Constraint Resolution 2
Declare Your Language: Constraint Resolution 2Declare Your Language: Constraint Resolution 2
Declare Your Language: Constraint Resolution 2Eelco Visser
 
Python Peculiarities
Python PeculiaritiesPython Peculiarities
Python Peculiaritiesnoamt
 
GoLightly - a customisable virtual machine written in Go
GoLightly - a customisable virtual machine written in GoGoLightly - a customisable virtual machine written in Go
GoLightly - a customisable virtual machine written in GoEleanor McHugh
 
ML: A Strongly Typed Functional Language
ML: A Strongly Typed Functional LanguageML: A Strongly Typed Functional Language
ML: A Strongly Typed Functional Languagelijx127
 
The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184Mahmoud Samir Fayed
 
Bayesian workflow with PyMC3 and ArviZ
Bayesian workflow with PyMC3 and ArviZBayesian workflow with PyMC3 and ArviZ
Bayesian workflow with PyMC3 and ArviZCorrie Bartelheimer
 
Part2 from math import * from simpson import * k=1 def f(x): return (exp(-(x...
Part2 from math import * from simpson import *  k=1 def f(x): return (exp(-(x...Part2 from math import * from simpson import *  k=1 def f(x): return (exp(-(x...
Part2 from math import * from simpson import * k=1 def f(x): return (exp(-(x...hwbloom25
 
The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88Mahmoud Samir Fayed
 
Palestra sobre Collections com Python
Palestra sobre Collections com PythonPalestra sobre Collections com Python
Palestra sobre Collections com Pythonpugpe
 
Class Customization and Better Code
Class Customization and Better CodeClass Customization and Better Code
Class Customization and Better CodeStronnics
 
Python data structures
Python data structuresPython data structures
Python data structuresHarry Potter
 
Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''OdessaJS Conf
 

Tendances (15)

dplyr and torrents from cpasbien
dplyr and torrents from cpasbiendplyr and torrents from cpasbien
dplyr and torrents from cpasbien
 
Python Tidbits
Python TidbitsPython Tidbits
Python Tidbits
 
Declare Your Language: Constraint Resolution 2
Declare Your Language: Constraint Resolution 2Declare Your Language: Constraint Resolution 2
Declare Your Language: Constraint Resolution 2
 
Python Peculiarities
Python PeculiaritiesPython Peculiarities
Python Peculiarities
 
GoLightly - a customisable virtual machine written in Go
GoLightly - a customisable virtual machine written in GoGoLightly - a customisable virtual machine written in Go
GoLightly - a customisable virtual machine written in Go
 
ML: A Strongly Typed Functional Language
ML: A Strongly Typed Functional LanguageML: A Strongly Typed Functional Language
ML: A Strongly Typed Functional Language
 
The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184The Ring programming language version 1.5.3 book - Part 46 of 184
The Ring programming language version 1.5.3 book - Part 46 of 184
 
Bayesian workflow with PyMC3 and ArviZ
Bayesian workflow with PyMC3 and ArviZBayesian workflow with PyMC3 and ArviZ
Bayesian workflow with PyMC3 and ArviZ
 
Part2 from math import * from simpson import * k=1 def f(x): return (exp(-(x...
Part2 from math import * from simpson import *  k=1 def f(x): return (exp(-(x...Part2 from math import * from simpson import *  k=1 def f(x): return (exp(-(x...
Part2 from math import * from simpson import * k=1 def f(x): return (exp(-(x...
 
The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88The Ring programming language version 1.3 book - Part 36 of 88
The Ring programming language version 1.3 book - Part 36 of 88
 
Palestra sobre Collections com Python
Palestra sobre Collections com PythonPalestra sobre Collections com Python
Palestra sobre Collections com Python
 
Class Customization and Better Code
Class Customization and Better CodeClass Customization and Better Code
Class Customization and Better Code
 
Python Basics #1
Python Basics #1Python Basics #1
Python Basics #1
 
Python data structures
Python data structuresPython data structures
Python data structures
 
Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''Christian Gill ''Functional programming for the people''
Christian Gill ''Functional programming for the people''
 

Similaire à The groovy puzzlers (as Presented at Gr8Conf US 2014)

Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Baruch Sadogursky
 
The Groovy Puzzlers – The Complete 01 and 02 Seasons
The Groovy Puzzlers – The Complete 01 and 02 SeasonsThe Groovy Puzzlers – The Complete 01 and 02 Seasons
The Groovy Puzzlers – The Complete 01 and 02 SeasonsBaruch Sadogursky
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingMuthu Vinayagam
 
Monadologie
MonadologieMonadologie
Monadologieleague
 
Kotlin from-scratch 2 - functions
Kotlin from-scratch 2 - functionsKotlin from-scratch 2 - functions
Kotlin from-scratch 2 - functionsFranco Lombardo
 
Probabilistic Programming in Scala
Probabilistic Programming in ScalaProbabilistic Programming in Scala
Probabilistic Programming in ScalaBeScala
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming iiPrashant Kalkar
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that LetterKevlin Henney
 
[CONFidence 2016] Mateusz Kocielski - Torturing the PHP interpreter
[CONFidence 2016] Mateusz Kocielski - Torturing the PHP interpreter [CONFidence 2016] Mateusz Kocielski - Torturing the PHP interpreter
[CONFidence 2016] Mateusz Kocielski - Torturing the PHP interpreter PROIDEA
 
Torturing the PHP interpreter
Torturing the PHP interpreterTorturing the PHP interpreter
Torturing the PHP interpreterLogicaltrust pl
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecLoïc Descotte
 
Exhibition of Atrocity
Exhibition of AtrocityExhibition of Atrocity
Exhibition of AtrocityMichael Pirnat
 
Pick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruitPick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruitVaclav Pech
 
여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala LanguageAshal aka JOKER
 
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonByterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonakaptur
 

Similaire à The groovy puzzlers (as Presented at Gr8Conf US 2014) (20)

Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
 
The Groovy Puzzlers – The Complete 01 and 02 Seasons
The Groovy Puzzlers – The Complete 01 and 02 SeasonsThe Groovy Puzzlers – The Complete 01 and 02 Seasons
The Groovy Puzzlers – The Complete 01 and 02 Seasons
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
 
Monadologie
MonadologieMonadologie
Monadologie
 
Java VS Python
Java VS PythonJava VS Python
Java VS Python
 
Kotlin from-scratch 2 - functions
Kotlin from-scratch 2 - functionsKotlin from-scratch 2 - functions
Kotlin from-scratch 2 - functions
 
Probabilistic Programming in Scala
Probabilistic Programming in ScalaProbabilistic Programming in Scala
Probabilistic Programming in Scala
 
Functional programming ii
Functional programming iiFunctional programming ii
Functional programming ii
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that Letter
 
[CONFidence 2016] Mateusz Kocielski - Torturing the PHP interpreter
[CONFidence 2016] Mateusz Kocielski - Torturing the PHP interpreter [CONFidence 2016] Mateusz Kocielski - Torturing the PHP interpreter
[CONFidence 2016] Mateusz Kocielski - Torturing the PHP interpreter
 
Torturing the PHP interpreter
Torturing the PHP interpreterTorturing the PHP interpreter
Torturing the PHP interpreter
 
Scala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar ProkopecScala presentation by Aleksandar Prokopec
Scala presentation by Aleksandar Prokopec
 
Exhibition of Atrocity
Exhibition of AtrocityExhibition of Atrocity
Exhibition of Atrocity
 
Pick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruitPick up the low-hanging concurrency fruit
Pick up the low-hanging concurrency fruit
 
Poly-paradigm Java
Poly-paradigm JavaPoly-paradigm Java
Poly-paradigm Java
 
Oop lecture9 13
Oop lecture9 13Oop lecture9 13
Oop lecture9 13
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language여자개발자모임터 6주년 개발 세미나 - Scala Language
여자개발자모임터 6주년 개발 세미나 - Scala Language
 
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonByterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
 

Dernier

Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 

Dernier (20)

Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 

The groovy puzzlers (as Presented at Gr8Conf US 2014)

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. 1. Funny Puzzling questions 2. You think and vote 3. Lots of T-shirts flying in the air 4. Official twitter handle! groovypuzzlers 5. Two entertaining guys on stage
  • 11.
  • 12.
  • 14.
  • 15.
  • 17.
  • 18. (-3).abs() int value = -3 value.abs()
  • 19.
  • 21.
  • 22.
  • 23. -3 Caught: java.lang.NullPointerException: Cannot invoke method abs() on null object java.lang.NullPointerException: Cannot invoke method abs() on null object at AbsolutelyGroovy.run(AbsolutelyGroovy.groovy:7) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) println (-3).abs()
  • 24. “All problems in computer science can be solved by another pair of parentheses” John McCarthy, the inventor of LISP
  • 25. println ((-3).abs()) int value = -3 println value.abs()
  • 26.
  • 27.
  • 28. def range = 1.0..10.0 assert range.contains(5.0) println range.contains(5.6)
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. Iterator iterator = (1.0..10.0).iterator() while (iterator.hasNext()) { print "${iterator.next()} " } 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39. def key = 'x' def map = [key: 'treasure'] def value = map.get(key) println value
  • 40. def key = 'x' def map = [key: 'treasure'] def value = map.get(key) println value
  • 41.
  • 42.
  • 43. 1.def map = [(key): 'treasure'] 2.map.put(key, 'treasure') 3.map."$key" = 'treasure' 4.map[key] = 'treasure'
  • 44.
  • 45. def map = [2: 'treasure'] def key = 2 def value = map."$key" println value
  • 46. def map = [2: 'treasure'] def key = 2 def value = map."$key" println value
  • 47.
  • 48. def map = [2: 'treasure'] println map.keySet().first().class.name java.lang.Integer
  • 49.
  • 50.
  • 51. List<Integer> list = [1,2,3] def now = new Date() list << now println list
  • 52. List<Integer> list = [1,2,3] def now = new Date() list << now println list
  • 53.
  • 54.
  • 55.
  • 56.
  • 57. List<Integer> list = [1,2,3] def now = new Date() list << now list << 'foo' println list*.class.name [java.lang.Integer, java.lang.Integer, java.lang.Integer, java.util.Date, java.lang.String]
  • 58.
  • 59. def map = [metaClass: ] println "What's the $map.metaClass, Andres?"
  • 60.
  • 61.
  • 63.
  • 64.
  • 65.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76. boolean isPrime(def x) { if (x == 2) return true int limit = Math.sqrt(x) + 1 (2..limit).each { if (x % it == 0) { return false } } true } println isPrime("4" as Double)
  • 77.
  • 78. boolean isPrime(def x) { if (x == 2) return true int limit = Math.sqrt(x) + 1 (2..limit).each { if (x % it == 0) { return false } } true } println isPrime("4" as Double)
  • 79. boolean isPrime(def x) { if (x == 2) return true int limit = Math.sqrt(x) + 1 (2..limit).each { if (x % it == 0) { return false } } true } println isPrime("4" as Double)
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 87.
  • 88.
  • 89.
  • 90. class VanHalen { public static jump() { "Here are the ${lyrics()}" } def methodMissing(String name, def args) { 'lyrics' } } println VanHalen.jump()
  • 91. class VanHalen { public static jump() { "Here are the ${lyrics()}" } def methodMissing(String name, def args) { 'lyrics' } } println VanHalen.jump()
  • 92.
  • 93.
  • 94.
  • 95.
  • 96. class VanHalen { public static jump() { "Here are the ${lyrics()}" } static $static_methodMissing(String name, def args) { 'lyrics' } } println VanHalen.jump()
  • 97. class VanHalen { public jump() { "Here are the ${lyrics()}" } def methodMissing(String name, def args) { 'lyrics' } } println new VanHalen().jump()
  • 98.
  • 99. double value = 3 println "$value.14".isDouble()
  • 100.
  • 101.
  • 102.
  • 103. double value = 3 println "$value.14".isDouble()
  • 104.
  • 105.
  • 106.
  • 107.
  • 108. class Invite { int attending = 1 } def invite = new Invite() def attendees = (invite.attending) +1 println attendees
  • 109. class Invite { int attending = 1 } def invite = new Invite() def attendees = (invite.attending) +1 println attendees
  • 110.
  • 111.
  • 112.
  • 113.
  • 114. def attendees = (new Invite().attending) + 1 println attendees def invite = new Invite() println (invite.attending +1)
  • 115.
  • 116.
  • 117. 1. Write readable code 2. Comment neat tricks 3. Sometimes it is just a bug 4. Use static code analysis (intellij IDEA!) 5. Rtfm 6. Don’t code like my brother
  • 118. We have just started! (may end up in proper overalls) Puzzlers? Gotchas? Fetal position inducing behavior? - puzzlers jfrog.com - Groovypuzzlers
  • 119.
  • 120. Positive feedback? Praise us on twitter groovypuzzlers - aalmiray - jbaruch Negative feeback? /dev/null