Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Modern Java for the Masses! Is Java Still Relevant?

Modern Java for the Masses! Is Java Still Relevant?

Deepu K Sasidharan

November 23, 2023
Tweet

More Decks by Deepu K Sasidharan

Other Decks in Programming

Transcript

  1. Modern Java for the
    Masses! Is Java Still
    Relevant?
    Deepu K Sasidharan

    View full-size slide

  2. @oktaDev | @deepu105 | deepu.tech
    ➔ JHipster co-lead developer
    ➔ Java Champion
    ➔ Creator of KDash, JDL Studio
    ➔ Developer Advocate @ Okta
    ➔ OSS aficionado, polyglot dev,
    author, speaker
    Hi, I’m Deepu K Sasidharan
    @[email protected] deepu.tech
    @deepu105 deepu05

    View full-size slide

  3. @oktaDev | @deepu105 | deepu.tech
    I’m a
    Polyglot
    Developer

    View full-size slide

  4. @oktaDev | @deepu105 | deepu.tech
    My Journey With Programming Languages
    PHP
    JavaScript
    C++
    Java
    Dr Scheme
    Java
    JavaScript
    Go
    TypeScript
    Python, Ruby
    Rust
    C#
    2003 2006-2008 2010 2010-2016 2016-2020 2021

    View full-size slide

  5. @oktaDev | @deepu105 | deepu.tech
    My Favorite Programming Languages

    View full-size slide

  6. @oktaDev | @deepu105 | deepu.tech
    I ❤ Rust

    View full-size slide

  7. @oktaDev | @deepu105 | deepu.tech
    Is Java Still Relevant?

    View full-size slide

  8. @oktaDev | @deepu105 | deepu.tech
    Boring?
    Old?
    Stagnant?

    View full-size slide

  9. @oktaDev | @deepu105 | deepu.tech
    Age of Popular Mainstream Languages
    Go
    C# Rust
    1991
    1985 2011
    2009
    2000 2015
    Ruby
    Kotlin
    1995
    Python
    PHP
    JavaScript
    C++ Java
    1972 2023

    View full-size slide

  10. @oktaDev | @deepu105 | deepu.tech
    TIOBE Popularity Index

    View full-size slide

  11. @oktaDev | @deepu105 | deepu.tech
    Intellimenta Popularity Index (Stack Overflow Data)

    View full-size slide

  12. @oktaDev | @deepu105 | deepu.tech
    Evolution
    of Java

    View full-size slide

  13. @oktaDev | @deepu105 | deepu.tech
    Java Evolution (The Boring Phase)
    JDK
    GC
    Green Threads
    JVM
    1.0
    1996
    Platform Threads
    Inner Classes
    JDBC
    JIT
    Reflection
    1.1
    1997
    Swing
    Collections
    HotSpot JVM
    JNDI
    RegEx
    JAXP
    Logging API
    NIO
    1.2 - 1.3 - 1.4
    1998 - 2000 - 2002
    Generics
    Annotations
    Enums
    Static Imports
    Concurrency utils
    1.5 (5)
    2004
    Modules
    HTTP2 Client
    JShell
    Private Interface
    -methods
    9
    2017
    ForkJoinPool
    JAX-WS
    Compiler API
    GC algos
    Diamond Operator
    NIO 2
    6 - 7
    2006 - 2011
    Streams
    CompletableFuture
    Lambda
    Optionals
    Functional Interface
    Nashorn
    8 (LTS)
    2014

    View full-size slide

  14. @oktaDev | @deepu105 | deepu.tech
    Java Evolution (The Exciting Phase)
    JDK
    var type inference
    Parallel to G1
    JIT Compiler (E)
    10
    2017
    HTTP Client API
    Single file launch
    11 (LTS)
    2018
    Switch Expressions (P)
    Text Blocks (P)
    12 - 13
    2019
    Instanceof pattern
    -matching (P)
    Records (P)
    Switch Expressions
    Packaging Tool (I)
    Foreign-Memory
    -Access API (I)
    Sealed Classes (P)
    Hidden Classes
    Text Blocks
    14-15
    2020
    Scoped Values (I)
    String Templates (P)
    Sequenced Collections
    Generational ZGC
    Record Patterns
    Pattern Matching for
    -switch
    Unnamed Patterns and
    -Variables (P)
    Virtual Threads
    Unnamed Classes and
    -Instance Main
    -Methods (P)
    Scoped Values (P)
    20-21 (LTS)
    2023
    Vector API (I)
    Foreign Linker API (I)
    Packaging Tool
    Instanceof pattern
    -matching
    Records
    Pattern Matching for
    -switch (P)
    Sealed Classes
    Foreign Function &
    -Memory API (I)
    16 - 17 (LTS)
    2021
    Simple Web Server
    Record Patterns (P)
    Virtual Threads (P)
    Structured
    -Concurrency (I)
    18-19
    2022
    E - Experimental
    P - Preview
    I - Incubator

    View full-size slide

  15. @oktaDev | @deepu105 | deepu.tech
    Modern Java

    View full-size slide

  16. @oktaDev | @deepu105 | deepu.tech
    ● Locar var Type Inference
    ● Text Blocks
    ● Switch Expressions
    ● Pattern Matching for Instanceof
    ● Pattern Matching for Switch
    ● Records
    ● Foreign Function & Memory API
    ● Sealed Classes
    ● Hidden Classes
    ● Vector API
    ● Simple Web Server
    ● Record Patterns
    ● Virtual Threads
    ● Structured Concurrency
    ● Scoped Values
    ● String Templates
    ● Sequenced Collections
    ● Unnamed Patterns and Variables
    ● Unnamed Classes and Instance Main Methods
    Java 10 - 21

    View full-size slide

  17. @oktaDev | @deepu105 | deepu.tech
    Modern Java
    Language features
    ☑ Strongly typed
    ☑ Generics
    ☑ Pattern matching
    ☑ Coroutines (Virtual Threads)
    ☑ Foreign Functions
    ☑ Rich standard Library
    ☑ Object Oriented programming
    ☑ Functional programming
    ☑ Higher-order-functions & Closures (Lambda)
    ☑ Type inference (Local var)
    ☑ Object deconstruction (Records and Array only)
    ☑ Immutable
    ☑ Null safe
    Tooling & Ecosystem
    ☑ JIT
    ☑ AOT (via GraalVM)
    ☑ Build system (Maven or Gradle)
    ☑ Package Manager (Maven or Gradle)
    ☑ Package repository (Maven Central)
    ☑ Formatting/Linting (Plugins)
    ☑ Shell (JShell)

    View full-size slide

  18. @oktaDev | @deepu105 | deepu.tech
    Java 21
    void main() {
    var name = "Deepu";
    System.out.println(STR. "Hello, \{ name }!" );
    var point = new Point(10, 10);
    switch (point) {
    case Point(var x, var _) when x > 5 -> System.out.println("It’s a big X point");
    case Point(var _, var y) when y > 5 -> System.out.println("It’s a big Y point");
    default -> System.out.println("It’s just a point");
    }
    Thread.startVirtualThread(() -> {
    System.out.println("Hello, Project Loom!");
    });
    }
    record Point(int x, int y) {}

    View full-size slide

  19. @oktaDev | @deepu105 | deepu.tech
    So Why
    Java?

    View full-size slide

  20. @oktaDev | @deepu105 | deepu.tech
    Strengths of Java

    View full-size slide

  21. @oktaDev | @deepu105 | deepu.tech
    Mature
    Ecosystem

    View full-size slide

  22. @oktaDev | @deepu105 | deepu.tech
    Stability

    View full-size slide

  23. @oktaDev | @deepu105 | deepu.tech
    Community

    View full-size slide

  24. © Okta and/or its affiliates. All rights reserved. Confidential Information of Okta – For Recipient’s Internal Use Only.
    @oktaDev | @deepu105 | deepu.tech
    Java == Building a Critical Service
    or SaaS Company

    View full-size slide

  25. © Okta and/or its affiliates. All rights reserved. Confidential Information of Okta – For Recipient’s Internal Use Only.
    @oktaDev | @deepu105 | deepu.tech
    Rust == Coding for Fun or Building
    OSS Side Projects

    View full-size slide

  26. @oktaDev | @deepu105 | deepu.tech
    Weakness of Java

    View full-size slide

  27. @oktaDev | @deepu105 | deepu.tech
    Baggage

    View full-size slide

  28. @oktaDev | @deepu105 | deepu.tech

    View full-size slide

  29. @oktaDev | @deepu105 | deepu.tech
    Resource
    Hungry

    View full-size slide

  30. @oktaDev | @deepu105 | deepu.tech
    When To Use Java

    View full-size slide

  31. @oktaDev | @deepu105 | deepu.tech
    Right Tool
    for the
    Job!

    View full-size slide

  32. © Okta and/or its affiliates. All rights reserved. Confidential Information of Okta – For Recipient’s Internal Use Only.
    @oktaDev | @deepu105 | deepu.tech
    Right Language
    Use Case
    Team Experience
    Target Platform
    Memory Safety

    View full-size slide

  33. @oktaDev | @deepu105 | deepu.tech
    Web Applications/Microservices
    ● Great ecosystem and frameworks
    ○ Spring, JHipster, Micronaut, Quarkus, Jakarta EE, etc
    ● Reliable and high performing
    ○ With an optimized impl, can often outperform Rust/C++
    ● Fast ramp up and go to market
    ● High concurrency
    Enterprise Applications
    ● Secure
    ● Reliable and high performing
    ● Backward compatibility
    ● Mature ecosystem
    When to Use Java
    Big Data Applications
    ● Great ecosystem
    ○ Apache Hadoop, Apache Spark
    ● Scalable for large volume of data
    ● High concurrency
    ● Reliable
    Android Applications
    ● One of the primary language
    ● Great ecosystem

    View full-size slide

  34. @oktaDev | @deepu105 | deepu.tech
    When not to use Java

    View full-size slide

  35. @oktaDev | @deepu105 | deepu.tech
    CLI Applications
    ● Not a lot of good libraries
    ● Limited support for interactions
    ● No Curses/Terminal UI
    ● Use Rust, Go, Python or NodeJS
    Real-Time Systems
    ● Aerospace, Robotics, High frequency trading
    ● GC pauses cannot guarantee real-time responses
    ● Use Ada, Rust, C/C++
    When Not to Use Java
    Systems programming
    ● Drivers, OS, CLIs
    ● Not suitable for low-level programming
    ● GC overhead
    ● Weak Foreign Function Interface
    ● Use Rust, C/C++
    High Performance Systems
    ● GC overhead
    ● High memory usage
    ● No Zero Cost Abstractions
    ● Use Rust, C/C++

    View full-size slide

  36. @oktaDev | @deepu105 | deepu.tech
    Java for beginners

    View full-size slide

  37. © Okta and/or its affiliates. All rights reserved. Confidential Information of Okta – For Recipient’s Internal Use Only.
    @oktaDev | @deepu105 | deepu.tech
    Beginner
    Java as
    First-Language
    Knows another
    Language
    ● Learn with the latest version
    ● Learn types, operators, functions, control
    flow, generics, pattern matching
    ● Learn Java specifics (Classes, inheritance,
    polymorphism, abstraction, lambda, virtual
    threads)
    ● Learn basics of OOP and Functional
    programming
    ● Learn data structures
    ● Learn the Java standard library
    ● Do not learn with frameworks, learn with
    pure Java
    ● Learn with the latest version
    ● Learn Java specifics (Classes, inheritance,
    polymorphism, abstraction, lambda, virtual
    threads)
    ● Learn basics of OOP and Functional
    programming if needed
    ● Learn the Java standard library
    ● Learn Maven or Gradle
    ● Learn Spring Framework

    View full-size slide

  38. @oktaDev | @deepu105 | deepu.tech
    Thank You
    Subscribe to our newsletter
    a0.to/nl-signup/java
    Try our free Spring Boot +
    Passkeys workshop
    a0.to/spring-boot

    View full-size slide