Remember the epic Java Puzzlers? Here’s the Groovy version, and we have some neat ones! Even though we are totally a Grails shop here at JFrog, some of these had us scratching our heads for days trying to figure them out.
And there is more! Contributions from the truly Groovy senseis, including @glaforge, @aalmiray, @tim_yates, @kenkousen make this talk an unforgettable journey to Groovy's O_O.
In this talk you’ll have the expected dose of fun and enlightenment hearing about our mistakes and failures, great and small, in hard core Groovy/Grails development.
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
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]
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()
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