Skip to content

Slide deck + code examples and snippets for GeeCON JShell talk

Notifications You must be signed in to change notification settings

kubamarchwicki/slides-java-jshell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java and REPL. Forget debugging, welcome joy and productivity

Abstract

Oh Java, my old, lousy and boilerplated friend. For ages, trying anything new (which luckily wasn’t that frequent after all) required starting a new project, followed by a Sandbox class and a public static void main method. Alternatively, a simple JUnit test was a nice entrypointt as well - if we were lucky enough to have some dependency management sorted out.

Thankfully, things have changed. With the Java9 a REPL has been introduced, everybody can just run an up-to-date Java shell and try out new syntaxt, new APIs, new libraries. Now we can feel like Scala, Clojure, Ruby, JavaScript, PHP, call whatever language developers - finally there.

In this talk I’ll walk through essential REPL examples, see how we can use JShell to try out new language features (like Java 10 var syntax, Java 9 Streams enhancements), but foremost, we will use it to build a real-life web application. Expect meat-only talk without theory, diagrams, useless "javax.swing.*" application examples.

Content

  • explain jshell

  • show some basic new Java9 features in the shell

  • show shell’s edit function based on exploring regular expressions and walking file trees

  • build a simple web application in shell (with SparkJava)

  • add web application features (web sockets)

  • showcase direct jshell to app communication

  • save the code from the jshell to be able to refactor it within the IDE

  • (optional) cover java9 module as an essential part of jshell environment

What do we get with a REPL workflow

  1. Learn the new language and libraries

  2. Write code with immediate feedback

  3. No build or deploy

  4. Easy way of creating faithful lies for our test

  5. Tools to understand the real world

  6. Fewer surprises when starting the application

  7. Add new libraries to a running application

  8. Run automatically unit test affected by a change

  9. Inspect and manage the state

  10. Stay in comfort of your favourite IDE

  11. Debug staging and production

Connect to jshell remotly, run jshell from the IDE

Inspirations

Daniel Lebrero - REPL Driven Development
Robert Field - JShell: An Interactive Shell for the Java Platform
Roy van Rijn - Brace Yourselves, the REPL is Coming
Interactive Java Support to your tool, Robert Field
Articles
Java9
Java9 modules

About

Slide deck + code examples and snippets for GeeCON JShell talk

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published