SlideShare a Scribd company logo
THE FUTURE OF JVM LANGUAGES
AND THE EVOLUTION OF PROGRAMMING LANGUAGES
Victor Szoltysek
4 MODERN JVM LANGUAGES
Programming
Language
1969
- Margaret Hamilton


(with stacks of assembly
code she wrote for the first
moon landing mission)
The Future of JVM Languages
?
43 00 00 00 inc ebx
MACHINE CODE ASSEMBLY
The Future of JVM Languages
No matter the programming language chosen, a
professional developer will write an average of
10 lines of code (LoC) day.
Frederick Brooks
1980
1980 - MOBILE
?
mov eax, $
x

cmp eax, 0x0C
jg en
d

beginning:
inc eax
cmp eax, 0x0C
jle beginnin
g

end:
while(x <= 12)
{
x++;
}
ASSEMBLY C
OLDER LANGUAGES STILL USED
2000
2000 - MOBILE
?
for (i = 0; i < m; i++) {
 

free(a[i])
;

}

free(a);
// Trick Question ! Nothing :)
C Java
The Future of JVM Languages
* Famous Linus Torvalds C++ rant!
OLDER LANGUAGES STILL USED
2022
2022 - MOBILE
- Java 8 (circa 2022)
The reports of my death are greatly
exaggerated.
OLDER LANGUAGES STILL USED
4 MODERN JVM LANGUAGES
public class ObjectExample {




private int value;


private String name;




public ObjectExample(int value, String name) {


this.value = value;


this.name = name;


}




public String getName() {


return name;


}




public void setName(String name) {


this.name = name;


}




public int getValue() {




return value;


}




public void setValue(int value) {


this.value = value;


}




public static void main(String[] args) {




ObjectExample object = new ObjectExample(1,"Awesome");




System.out.println("Name " + object.getName() + " Value " + object.getValue());


}


}


Java -> Groovy Objects
class ObjectExample {


int value


String name


}




object = new ObjectExample(value:1,name:"Awesome")




println "Name $object.name Value $object.value"


implicit Getters/Setters
semi colons optional
parentheses optional
interpolated Strings
named properties in Constructor
static void main not needed
variable type optional
default static imports
public class ObjectExample {




private int value;


private String name;




public ObjectExample(int value, String name) {


this.value = value;


this.name = name;


}




public String getName() {


return name;


}




public void setName(String name) {


this.name = name;


}




public int getValue() {




return value;


}




public void setValue(int value) {


this.value = value;


}




}


Java -> Scala Objects
case class ObjectExample(value: Int, name: String)




public class ObjectExample {




private int value;


private String name;




public ObjectExample(int value, String name) {


this.value = value;


this.name = name;


}




public String getName() {


return name;


}




public void setName(String name) {


this.name = name;


}




public int getValue() {




return value;


}




public void setValue(int value) {


this.value = value;


}




}


Java 8 -> Java 14 Records
public record ObjectExample(int value, String name)




import java.util.Arrays;


import java.util.HashMap;


import java.util.List;


import java.util.Map;




public class Main {


public static void main(String[] args) {




List<Integer> someItems = Arrays.asList(new Integer[]{1, 2, 3, 4});


for (Integer item : someItems) {


System.out.println(item);


}


Map<String, String> someMapping = new HashMap<>();


someMapping.put("ST", "started");


someMapping.put("IP", "in progress");


someMapping.put("DN", "done");




for (Map.Entry<String, String> entry : someMapping.entrySet()) {


String key = entry.getKey();


String value = entry.getValue();


System.out.println(key + " => " + value);


}


}


}


Java -> Groovy Collections
def someItems = [1, 2, 3, 4]


someItems.each {


println it


}


def someMapping = ["ST": "started", "IP": "in progress", "DN": "done"]


someMapping.each { key, val ->


println "$key => $val"


}


collection literals
default collection imports
closure parameter def optional (it)
import java.sql.*;


import java.util.ArrayList;


import java.util.List;




public class JavaSqlExample {




static class Book {


public String name;


public int price;




public Book(String name, int price) {


this.name = name;


this.price = price;


}


}




public static void main(String[] args) throws SQLException{




List<Book> books = new ArrayList<>();




try (Connection con = DriverManager.getConnection("jdbc:h2:mem:")) {




con.prepareStatement("CREATE TABLE books " +


"AS SELECT 'Animal Farm' AS name, 123 AS price").execute();




try (ResultSet rs = con.prepareStatement("SELECT * FROM books").executeQuery()) {


while (rs.next()) {


books.add(new Book(rs.getString("name"), rs.getInt("price")));


}


}


}




books.forEach((book) -> System.out.println("Book " + book.name + " Price - " + book.price));




}


}


Java -> Groovy SQL
def sql = Sql.newInstance "jdbc:h2:mem:"




sql.execute """


CREATE TABLE books


AS SELECT 'Animal Farm' AS name, 123 AS price


"""




sql.rows "SELECT * FROM books" each {


println "Book - $it.name , Price - $it.price"


}




sql.close()


multiline strings
dynamic types
simpli
fi
ed SQL
BufferedReader br = new BufferedReader(new FileReader("file.txt"));


try {


StringBuilder sb = new StringBuilder();


String line = br.readLine();




while (line != null) {


sb.append(line);


sb.append(System.lineSeparator());


line = br.readLine();


}


String everything = sb.toString();


} finally {


br.close();


}


Java -> Groovy
everything = new File("file.txt").text


many built in convenience methods


(
fi
les, xml, json, rest, console)
Process p = new ProcessBuilder("ifconfig",
“en0").start();


BufferedReader br = new BufferedReader(new
InputStreamReader(p.getInputStream()));


String line = br.readLine();


while(line != null){


System.out.println(line);


line = br.readLine();


}


println "ifconfig en0".execute().text
Groovy Goodness
if ((1.1 + 0.1) == 1.2)


System.out.println("Matches in Groovy, NOT!! in Java");


big decimal by default
execute directly on Unix (#)
#!/usr/bin/env groovy


println("Hello world")


chmod +x helloWorl
d

./helloWorld
@Grab(group='org.springframework', module='spring', version='2.5.6')


import org.springframework.jdbc.core.JdbcTemplate


download dependencies
String.metaClass.shout = {


delegate.toUpperCase()


}




println "Hello!".shout()


add methods to existing classes
return optional
String version = "UNKNOWN";


if(computer != null){


Soundcard soundcard = computer.getSoundcard();


if(soundcard != null){


USB usb = soundcard.getUSB();


if(usb != null){


version = usb.getVersion();


}


}


}


Java -> Groovy
version = computer?.getSoundcard()?.getUSB()?.getVersion() ?: "UNKNOWN";


elvis operator (?:)
safe navigation operator (?.)
public List<String> decrypt(List<String> encryptedText) {


return encryptedText.stream()


.map(this::decryptText)


.collect(Collectors.toList());


}


public List<String> decrypt(List<String> encryptedText) {


return encryptedText*.decryptText


}
spread dot operator (*.)
Groovy Testing


(Power Asserts)
Condition not satisfied
:

'Grails Goodness' == course.descriptio
n

| |
|

| | Groovy Goodnes
s

| com.mrhaki.blog.Course@3435ec
9

fals
e

4 differences (73% similarity
)

Gr(ails) Goodnes
s

Gr(oovy) Goodness
assert 'Grails Goodness' == course.description


Groovy Testing (Spock)
def "addition test "()
{

when: "2 is added to 2"
int sum = 2 + 2
then: "sum should be 4"
sum == 4
}
Groovy Testing (Spock)
Parametrized Inputs
def "Data Drive test - minimum of #a and #b is #c"()
{

expect
:

Math.min(a, b) ==
c

where
:

a | b ||
c

3 | 7 || 3
5 | 4 || 4
9 | 9 || 9
}
Groovy Testing (Spock+Geb)


Web Application Testing
def "API example (non-Html content) -- health check"() {
given:
go "https://status.github.com/api/status.json"
expect
:

$('pre').text().startsWith('{"status":"good"'
)

}
Groovy Building (Gradle)
apply plugin:'java'


apply plugin:'checkstyle'


apply plugin:'findbugs'


apply plugin:'pmd'


version ='1.0'


repositories {


mavenCentral()


}


dependencies {


testCompile group:'junit', name:'junit', version:'4.11'


}
vs XML Building (Maven)
<plugin>


<groupId>org.apache.maven.plugins</groupId>


<artifactId>maven-checkstyle-plugin</artifactId>


<version>2.12.1</version>


<executions>


<execution>


<configuration>


<configLocation>config/checkstyle/checkstyle.xml</configLocation>


<consoleOutput>true</consoleOutput>


<failsOnError>true</failsOnError>


</configuration>


<goals>


<goal>check</goal>


</goals>


</execution>


</executions>


</plugin>


<plugin>


<groupId>org.codehaus.mojo</groupId>


<artifactId>findbugs-maven-plugin</artifactId>


<version>2.5.4</version>


<executions>


<execution>


<goals>


<goal>check</goal>


</goals>


</execution>


</executions>


</plugin>


<plugin>


<groupId>org.apache.maven.plugins</groupId>


<artifactId>maven-pmd-plugin</artifactId>


<version>3.1</version>


<executions>


<execution>


<goals>


<goal>check</goal>


</goals>


</execution>


</executions>


</plugin>
Groovy Building (Gradle)


Signi
fi
cant Performance over Maven
Java 10+ Type Inference
var list = new ArrayList<String>(); // infers ArrayList<String
>

var stream = list.stream(); // infers Stream<String>
Java 13+ Switch Expressions
switch (day)
{

case MONDAY, FRIDAY, SUNDAY -> System.out.println(6)
;

case TUESDAY -> System.out.println(7)
;

case THURSDAY, SATURDAY -> System.out.println(8)
;

case WEDNESDAY -> System.out.println(9)
;

}
Java 15+ Text Blocks
public String textBlocks()
{

    return ""
"

        Get busy livin
g

        o
r

        get busy dying
.

        --Stephen King"""
;

}
Led to innumerable errors, vulnerabilities, and
system crashes, which have probably caused a
billion dollars of pain and damage in the last forty
years.
Tony Hoare
(on his invention of the null reference)
Kotlin - True Null Safety
var a: String = "abc"
a = null // compilation error
WHICH JVM LANGUAGE TO USE ?
(AND WHY STICK TO THE JVM?)
▸Steep Learning Curve


▸Compatibility Issues


▸Lackluster IDE Support


▸Negative Market Trend


▸Including Companies moving back to Java (including Twitter)


▸Opinion -> Strong Pass *
SCALA
Rare niches aside (Big Data)
GROOVY
▸Easy Learning Curve


▸Strong Industry and IDE Support (JetBrains/Google)


▸Dynamic Typing (a double edged sword)


▸Slowed Adoption


▸Opinion -> Consider (for build scripts and testing)


▸Prefer Gradle over Maven :)
▸Strong Industry and IDE Support


▸Modern Java 19+ features have still no caught up
with alternatives


▸Opinion -> Consider
JAVA 19+ (OR 8)
▸Easy Learning Curve


▸Strong Industry and IDE Support (JetBrains/Google)


▸True Null Safety


▸Gradle Scripts can be written in Kotlin


▸Opinion -> Strong Consider (especially for Android)
KOTLIN
IaaS
Bare-Metal
PaaS
FaaS (sometimes)
CaaS
(i.e. Kubernetes)
Productivity


+ Abstraction
C
Assembly
Java
Kotlin
Productivity


+ Abstraction
(sometimes)
▸Abstraction as a Core Productivity Accelerator


▸Diminishing returns with Higher Level Languages


▸Stronger returns are often elsewhere (frameworks, cloud, etc)


▸Consider Kotlin / Groovy (testing / building) / Scala as JVM
alternatives


▸Java isn’t going away
TAKEAWAYS
ADDITIONAL MATERIAL

More Related Content

PDF
Presentatie - Introductie in Groovy
ODP
Groovy Ast Transformations (greach)
PDF
TypeScript Introduction
PDF
Scala @ TechMeetup Edinburgh
ODP
AST Transformations
PDF
Kotlin Developer Starter in Android projects
PDF
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
PDF
Game Design and Development Workshop Day 1
Presentatie - Introductie in Groovy
Groovy Ast Transformations (greach)
TypeScript Introduction
Scala @ TechMeetup Edinburgh
AST Transformations
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android - STX Next Lightning Talks - Feb 12, 2016
Game Design and Development Workshop Day 1

Similar to The Future of JVM Languages (20)

PDF
Scala - en bedre Java?
PPTX
Groovy
PPTX
Intro to scala
ODP
Ast transformations
PDF
Scala - en bedre og mere effektiv Java?
PDF
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
PDF
Better Software: introduction to good code
ODP
Groovy intro for OUDL
PDF
[2019-07] GraphQL in depth (serverside)
PDF
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018
PDF
Refactoring to Macros with Clojure
PDF
Scala in Places API
PDF
JavaScript - new features in ECMAScript 6
PPSX
Java.lang.object
PDF
Kotlin @ Coupang Backend 2017
PDF
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
PDF
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
PDF
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
PDF
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
PDF
JJUG CCC 2011 Spring
Scala - en bedre Java?
Groovy
Intro to scala
Ast transformations
Scala - en bedre og mere effektiv Java?
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Better Software: introduction to good code
Groovy intro for OUDL
[2019-07] GraphQL in depth (serverside)
Kotlin for Android Developers - Victor Kropp - Codemotion Rome 2018
Refactoring to Macros with Clojure
Scala in Places API
JavaScript - new features in ECMAScript 6
Java.lang.object
Kotlin @ Coupang Backend 2017
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
pragmaticrealworldscalajfokus2009-1233251076441384-2.pdf
JJUG CCC 2011 Spring
Ad

More from VictorSzoltysek (20)

PDF
Cloud for Grownups - 🛑 No Kubernetes, 🌀 No Complexity, ✅ Just AWS-Powered Res...
PDF
The Gold Jacket Journey - How I passed 12 AWS Certs without Burning Out (and ...
PDF
Java on AWS Without the Headaches - Fast Builds, Cheap Deploys, No Kubernetes
PDF
Demystifying GitHub Actions - Harnessing the power of automation to streamlin...
PDF
ChatGPT and Beyond - Elevating DevOps Productivity
PDF
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
PDF
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
PDF
Simplified DevOps Bliss -with OpenAI API
PDF
From SpaceX Launch Pads to Rapid Deployments
PDF
Driving Process Improvements - A Guided Approach to Running Effective Retrosp...
PDF
Spaceships, Pull Requests and Feature Branching - A Principles-Based approac...
PDF
Real-World DevOps — 20 Practical Developers Tips for Tightening Your Operatio...
PDF
Real-World Application Observability - 11 Practical Developer Focused Tips
PDF
Victor's Awesome Retro Deck
PDF
Software Development in Internet Memes
PDF
Big Bangs, Monorails and Microservices - Feb 2020
PDF
Making your RDBMS fast!
PDF
SQL Tips + Tricks for Developers
PDF
Less is more the 7 wastes of lean software development
PDF
Modern day jvm controversies
Cloud for Grownups - 🛑 No Kubernetes, 🌀 No Complexity, ✅ Just AWS-Powered Res...
The Gold Jacket Journey - How I passed 12 AWS Certs without Burning Out (and ...
Java on AWS Without the Headaches - Fast Builds, Cheap Deploys, No Kubernetes
Demystifying GitHub Actions - Harnessing the power of automation to streamlin...
ChatGPT and Beyond - Elevating DevOps Productivity
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Simplified DevOps Bliss -with OpenAI API
From SpaceX Launch Pads to Rapid Deployments
Driving Process Improvements - A Guided Approach to Running Effective Retrosp...
Spaceships, Pull Requests and Feature Branching - A Principles-Based approac...
Real-World DevOps — 20 Practical Developers Tips for Tightening Your Operatio...
Real-World Application Observability - 11 Practical Developer Focused Tips
Victor's Awesome Retro Deck
Software Development in Internet Memes
Big Bangs, Monorails and Microservices - Feb 2020
Making your RDBMS fast!
SQL Tips + Tricks for Developers
Less is more the 7 wastes of lean software development
Modern day jvm controversies
Ad

Recently uploaded (20)

PDF
Mushroom cultivation and it's methods.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Machine Learning_overview_presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Getting Started with Data Integration: FME Form 101
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
A Presentation on Artificial Intelligence
PDF
Encapsulation theory and applications.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
Mushroom cultivation and it's methods.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Machine Learning_overview_presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Spectral efficient network and resource selection model in 5G networks
SOPHOS-XG Firewall Administrator PPT.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Group 1 Presentation -Planning and Decision Making .pptx
A comparative study of natural language inference in Swahili using monolingua...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Reach Out and Touch Someone: Haptics and Empathic Computing
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Getting Started with Data Integration: FME Form 101
Encapsulation_ Review paper, used for researhc scholars
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25-Week II
A Presentation on Artificial Intelligence
Encapsulation theory and applications.pdf
Network Security Unit 5.pdf for BCA BBA.

The Future of JVM Languages

  • 1. THE FUTURE OF JVM LANGUAGES AND THE EVOLUTION OF PROGRAMMING LANGUAGES Victor Szoltysek
  • 2. 4 MODERN JVM LANGUAGES
  • 5. - Margaret Hamilton (with stacks of assembly code she wrote for the first moon landing mission)
  • 7. ? 43 00 00 00 inc ebx MACHINE CODE ASSEMBLY
  • 9. No matter the programming language chosen, a professional developer will write an average of 10 lines of code (LoC) day. Frederick Brooks
  • 10. 1980
  • 12. ? mov eax, $ x cmp eax, 0x0C jg en d beginning: inc eax cmp eax, 0x0C jle beginnin g end: while(x <= 12) { x++; } ASSEMBLY C
  • 14. 2000
  • 16. ? for (i = 0; i < m; i++) { free(a[i]) ; } free(a); // Trick Question ! Nothing :) C Java
  • 18. * Famous Linus Torvalds C++ rant! OLDER LANGUAGES STILL USED
  • 19. 2022
  • 21. - Java 8 (circa 2022) The reports of my death are greatly exaggerated. OLDER LANGUAGES STILL USED
  • 22. 4 MODERN JVM LANGUAGES
  • 23. public class ObjectExample { 
 
 private int value; 
 private String name; 
 
 public ObjectExample(int value, String name) { 
 this.value = value; 
 this.name = name; 
 } 
 
 public String getName() { 
 return name; 
 } 
 
 public void setName(String name) { 
 this.name = name; 
 } 
 
 public int getValue() { 
 
 return value; 
 } 
 
 public void setValue(int value) { 
 this.value = value; 
 } 
 
 public static void main(String[] args) { 
 
 ObjectExample object = new ObjectExample(1,"Awesome"); 
 
 System.out.println("Name " + object.getName() + " Value " + object.getValue()); 
 } 
 } 
 Java -> Groovy Objects class ObjectExample { 
 int value 
 String name 
 } 
 
 object = new ObjectExample(value:1,name:"Awesome") 
 
 println "Name $object.name Value $object.value" implicit Getters/Setters semi colons optional parentheses optional interpolated Strings named properties in Constructor static void main not needed variable type optional default static imports
  • 24. public class ObjectExample { 
 
 private int value; 
 private String name; 
 
 public ObjectExample(int value, String name) { 
 this.value = value; 
 this.name = name; 
 } 
 
 public String getName() { 
 return name; 
 } 
 
 public void setName(String name) { 
 this.name = name; 
 } 
 
 public int getValue() { 
 
 return value; 
 } 
 
 public void setValue(int value) { 
 this.value = value; 
 } 
 
 } 
 Java -> Scala Objects case class ObjectExample(value: Int, name: String) 
 

  • 25. public class ObjectExample { 
 
 private int value; 
 private String name; 
 
 public ObjectExample(int value, String name) { 
 this.value = value; 
 this.name = name; 
 } 
 
 public String getName() { 
 return name; 
 } 
 
 public void setName(String name) { 
 this.name = name; 
 } 
 
 public int getValue() { 
 
 return value; 
 } 
 
 public void setValue(int value) { 
 this.value = value; 
 } 
 
 } 
 Java 8 -> Java 14 Records public record ObjectExample(int value, String name) 
 

  • 26. import java.util.Arrays; 
 import java.util.HashMap; 
 import java.util.List; 
 import java.util.Map; 
 
 public class Main { 
 public static void main(String[] args) { 
 
 List<Integer> someItems = Arrays.asList(new Integer[]{1, 2, 3, 4}); 
 for (Integer item : someItems) { 
 System.out.println(item); 
 } 
 Map<String, String> someMapping = new HashMap<>(); 
 someMapping.put("ST", "started"); 
 someMapping.put("IP", "in progress"); 
 someMapping.put("DN", "done"); 
 
 for (Map.Entry<String, String> entry : someMapping.entrySet()) { 
 String key = entry.getKey(); 
 String value = entry.getValue(); 
 System.out.println(key + " => " + value); 
 } 
 } 
 } 
 Java -> Groovy Collections def someItems = [1, 2, 3, 4] 
 someItems.each { 
 println it 
 } 
 def someMapping = ["ST": "started", "IP": "in progress", "DN": "done"] 
 someMapping.each { key, val -> 
 println "$key => $val" 
 } collection literals default collection imports closure parameter def optional (it)
  • 27. import java.sql.*; 
 import java.util.ArrayList; 
 import java.util.List; 
 
 public class JavaSqlExample { 
 
 static class Book { 
 public String name; 
 public int price; 
 
 public Book(String name, int price) { 
 this.name = name; 
 this.price = price; 
 } 
 } 
 
 public static void main(String[] args) throws SQLException{ 
 
 List<Book> books = new ArrayList<>(); 
 
 try (Connection con = DriverManager.getConnection("jdbc:h2:mem:")) { 
 
 con.prepareStatement("CREATE TABLE books " + 
 "AS SELECT 'Animal Farm' AS name, 123 AS price").execute(); 
 
 try (ResultSet rs = con.prepareStatement("SELECT * FROM books").executeQuery()) { 
 while (rs.next()) { 
 books.add(new Book(rs.getString("name"), rs.getInt("price"))); 
 } 
 } 
 } 
 
 books.forEach((book) -> System.out.println("Book " + book.name + " Price - " + book.price)); 
 
 } 
 } 
 Java -> Groovy SQL def sql = Sql.newInstance "jdbc:h2:mem:" 
 
 sql.execute """ 
 CREATE TABLE books 
 AS SELECT 'Animal Farm' AS name, 123 AS price 
 """ 
 
 sql.rows "SELECT * FROM books" each { 
 println "Book - $it.name , Price - $it.price" 
 } 
 
 sql.close() multiline strings dynamic types simpli fi ed SQL
  • 28. BufferedReader br = new BufferedReader(new FileReader("file.txt")); 
 try { 
 StringBuilder sb = new StringBuilder(); 
 String line = br.readLine(); 
 
 while (line != null) { 
 sb.append(line); 
 sb.append(System.lineSeparator()); 
 line = br.readLine(); 
 } 
 String everything = sb.toString(); 
 } finally { 
 br.close(); 
 } 
 Java -> Groovy everything = new File("file.txt").text many built in convenience methods ( fi les, xml, json, rest, console) Process p = new ProcessBuilder("ifconfig", “en0").start(); 
 BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); 
 String line = br.readLine(); 
 while(line != null){ 
 System.out.println(line); 
 line = br.readLine(); 
 } println "ifconfig en0".execute().text
  • 29. Groovy Goodness if ((1.1 + 0.1) == 1.2) 
 System.out.println("Matches in Groovy, NOT!! in Java"); big decimal by default execute directly on Unix (#) #!/usr/bin/env groovy 
 println("Hello world") chmod +x helloWorl d ./helloWorld @Grab(group='org.springframework', module='spring', version='2.5.6') 
 import org.springframework.jdbc.core.JdbcTemplate download dependencies String.metaClass.shout = { 
 delegate.toUpperCase() 
 } 
 
 println "Hello!".shout() add methods to existing classes return optional
  • 30. String version = "UNKNOWN"; 
 if(computer != null){ 
 Soundcard soundcard = computer.getSoundcard(); 
 if(soundcard != null){ 
 USB usb = soundcard.getUSB(); 
 if(usb != null){ 
 version = usb.getVersion(); 
 } 
 } 
 } Java -> Groovy version = computer?.getSoundcard()?.getUSB()?.getVersion() ?: "UNKNOWN"; elvis operator (?:) safe navigation operator (?.) public List<String> decrypt(List<String> encryptedText) { 
 return encryptedText.stream() 
 .map(this::decryptText) 
 .collect(Collectors.toList()); 
 } public List<String> decrypt(List<String> encryptedText) { 
 return encryptedText*.decryptText 
 } spread dot operator (*.)
  • 31. Groovy Testing (Power Asserts) Condition not satisfied : 'Grails Goodness' == course.descriptio n | | | | | Groovy Goodnes s | com.mrhaki.blog.Course@3435ec 9 fals e 4 differences (73% similarity ) Gr(ails) Goodnes s Gr(oovy) Goodness assert 'Grails Goodness' == course.description 

  • 32. Groovy Testing (Spock) def "addition test "() { when: "2 is added to 2" int sum = 2 + 2 then: "sum should be 4" sum == 4 }
  • 33. Groovy Testing (Spock) Parametrized Inputs def "Data Drive test - minimum of #a and #b is #c"() { expect : Math.min(a, b) == c where : a | b || c 3 | 7 || 3 5 | 4 || 4 9 | 9 || 9 }
  • 34. Groovy Testing (Spock+Geb) Web Application Testing def "API example (non-Html content) -- health check"() { given: go "https://status.github.com/api/status.json" expect : $('pre').text().startsWith('{"status":"good"' ) }
  • 35. Groovy Building (Gradle) apply plugin:'java' apply plugin:'checkstyle' apply plugin:'findbugs' apply plugin:'pmd' version ='1.0' repositories { mavenCentral() } dependencies { testCompile group:'junit', name:'junit', version:'4.11' }
  • 36. vs XML Building (Maven) <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <version>2.12.1</version> <executions> <execution> <configuration> <configLocation>config/checkstyle/checkstyle.xml</configLocation> <consoleOutput>true</consoleOutput> <failsOnError>true</failsOnError> </configuration> <goals> <goal>check</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId> <version>2.5.4</version> <executions> <execution> <goals> <goal>check</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> <version>3.1</version> <executions> <execution> <goals> <goal>check</goal> </goals> </execution> </executions> </plugin>
  • 37. Groovy Building (Gradle) Signi fi cant Performance over Maven
  • 38. Java 10+ Type Inference var list = new ArrayList<String>(); // infers ArrayList<String > var stream = list.stream(); // infers Stream<String>
  • 39. Java 13+ Switch Expressions switch (day) { case MONDAY, FRIDAY, SUNDAY -> System.out.println(6) ; case TUESDAY -> System.out.println(7) ; case THURSDAY, SATURDAY -> System.out.println(8) ; case WEDNESDAY -> System.out.println(9) ; }
  • 40. Java 15+ Text Blocks public String textBlocks() {     return "" "         Get busy livin g         o r         get busy dying .         --Stephen King""" ; }
  • 41. Led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years. Tony Hoare (on his invention of the null reference)
  • 42. Kotlin - True Null Safety var a: String = "abc" a = null // compilation error
  • 43. WHICH JVM LANGUAGE TO USE ? (AND WHY STICK TO THE JVM?)
  • 44. ▸Steep Learning Curve ▸Compatibility Issues ▸Lackluster IDE Support ▸Negative Market Trend ▸Including Companies moving back to Java (including Twitter) ▸Opinion -> Strong Pass * SCALA Rare niches aside (Big Data)
  • 45. GROOVY ▸Easy Learning Curve ▸Strong Industry and IDE Support (JetBrains/Google) ▸Dynamic Typing (a double edged sword) ▸Slowed Adoption ▸Opinion -> Consider (for build scripts and testing) ▸Prefer Gradle over Maven :)
  • 46. ▸Strong Industry and IDE Support ▸Modern Java 19+ features have still no caught up with alternatives ▸Opinion -> Consider JAVA 19+ (OR 8)
  • 47. ▸Easy Learning Curve ▸Strong Industry and IDE Support (JetBrains/Google) ▸True Null Safety ▸Gradle Scripts can be written in Kotlin ▸Opinion -> Strong Consider (especially for Android) KOTLIN
  • 50. ▸Abstraction as a Core Productivity Accelerator ▸Diminishing returns with Higher Level Languages ▸Stronger returns are often elsewhere (frameworks, cloud, etc) ▸Consider Kotlin / Groovy (testing / building) / Scala as JVM alternatives ▸Java isn’t going away TAKEAWAYS