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

Modern Java for the Masses! Is Java Still Relev...

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. @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
  2. @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
  3. @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
  4. @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
  5. @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
  6. @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
  7. @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)
  8. @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) {}
  9. © 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
  10. © 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
  11. © 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
  12. @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
  13. @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++
  14. © 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
  15. @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