groovy - dave-reed.com · apache groovy developed by james strachan talked about wanting to create...
TRANSCRIPT
Apache GroovyParker Johnson
Brad Koenen
Brief History of Java
❏ One of the most popular languages in use today
❏ At the core of Java is the Java Virtual Machine (JVM)❏ JVM’s exist for almost all popular operating systems
❏ Released in 1995❏ Before the web became a major platform for apps and business
❏ Many other languages have come along to fill the gap
❏ High performance, compiled, statically typed language
Apache Groovy
❏ Developed by James Strachan
❏ Talked about wanting to create a “groovy” new language that runs
on the JVM
❏ Wanted to address the shortcomings of Java
❏ First appeared in 2003
❏ Version 1.0 released in 2007
❏ Open source under Apache license
Apache Groovy
❏ Uses the JVM
❏ Enhancement to Java❏ Modern language syntax
❏ Compiles directly into Java code
❏ Call Java code from Groovy and vice versa
❏ Able to use almost all existing Java libraries❏ Java with less boilerplate and more power
features
A Closer Look“Powerful, optionally typed and dynamic language, with static-typing and static compilation capabilities” groovy-lang.org
❏ Powerful❏ Seamless access to almost all existing Java libraries❏ Dynamically typed
❏ Majority of type checking is done at run-time❏ Values have types, variables do not
❏ Options❏ Dynamic when you need to crank out code fast❏ Statically compiled for code that is production ready and more long term❏ Static typing also allows for easier debugging
❏ compiler errors vs. runtime errors
Goals
Web Dev
ImproveDevelopment Experience
Optional Typing Seamless
Code Examples
Cleaner CodeFlat learning curve
-Control statements
-Functions
-Inheritance
-Data types
Traditional Java CodeFor loop is more drawn out, initializing “i” variable and continuing on.
Apache Groovy CodeGroovy allows an upto method, provided the size of the loop necessary. “$” is a closure that gives the value of the current loop.
Control Statements
Functions
“It” is a keyword used to represent a single parameter.
Simple Inheritance
Data Types - Bytes to BooleanNo semicolons! SEE CONSOLE
Why not just use Java?Trade-offs
Who uses Groovy?
Netflix
Cisco
Best Buy
MasterCard
Sony
Oracle
Target
Walmart
Why?
❏ Embedded Business Language (Domain-Specific Language)
❏ Netflix uses Groovy to offer various levels of filtering through Groovy scripts
❏ Mainly used in production code
❏ Existing Java libraries❏ JVM❏ Improved dev experience
Sourceshttp://groovy-lang.org/
https://detechter.com/everything-wanted-know-groovy-language/
https://www.java.com/en/
https://www.udemy.com/apache-groovy/ (Introduction)
https://www.tutorialspoint.com/groovy/
Questions?