Create
Learn
Share

Java Posse 101

rename
Updated 2007-06-14 08:21

Summary

Terms and technologies mentioned in
http://www.javaposse.com/index.php?post_id=175667
of The Java Posse podcast.

Interviewees

Question Answer
Names (of interviewees)Dr Paul King, Jon Skeet
Paul's jobManaging Director and Principal Consultant (at ASERT)
Jon's jobSoftware engineer (and inveterate technological dabbler)
Book they're writingGroovy in Action (Manning)
Other authors (of book)Dierk Koenig, Guillaume Laforge, Andrew Glover
memorize

Talking points

Question Answer
Groovy has features from...Perl, Python, Ruby
Groovy is a...dynamically typed language
Plans for generics? (in Groovy)currently none
Can variables be strongly-typed? (in Groovy)yes, but checked at runtime
Can you extend groovy classes with Java?yes (and vise-versa)
memorize

More

Question Answer
Speed of Groovybetween 3-4 times slower than Java to the same speed (rough estimate)
Does Groovy support annotations?not yet
Can you embed Groovy code in ant?yes
Do closures exist it C#?yes, but with more typing (than Groovy)
Some shortcuts Groovy providesXML, SQL, Regular Expressions, Servlets, Swing, Ant, COM Scripting
memorize

Groovy features

FeatureDescription
Closuresanonamous block of code (passable as a parameter)
Builders (Groovy feature)consistent way of building tree structures
Some Groovy buildersAntBuilder, SwingBuilder, SAXBuilder, MarkupBuilder (xml)
GPathpath language for accessing parts of tree structures
memorize

Tools

ToolDescription
GrailsGroovy-based web framework (inspired by Ruby on Rails)
GORM(Grails Object-Relational Mapping) framework to access a DB
Groovy SOAPRun and call SOAP servers
GSPGroovy Server Pages
Groovletssimplified Groovy version of servlets
LINQMicrosoft framework for accessing a DB(not yet released)
memorize

Relevant code examples

FeatureWorking Groovy Code
Run closure on a list
[1, 2, 3].collect( { println it*2 } )
Prints "2 4 6"
Optional typing
String t = "Hi"
x = 123
Http and GPath
xml = new URL("http://feeds.feedburner.com/javaposse").text 
println new XmlSlurper().parseText( xml ).channel.description.text()
Prints "Java News and Interviews"
Builder
new AntBuilder().delete() { fileset( dir:".", includes:"**/*.txt" ) }
Deletes all *.txt files, recursively
Sql select
sql.eachRow("select * from t") { println it.foo }
Prints 'foo' field of each record
memorize

See also

Java Posse - all Java Posse episodes
http://www.javaposse.com/index.php?post_id=175667