World Congress 2024

Algebraic Data Types + Pattern Matching = Elegant and readable Java code

July 19, 2024 11:40 – 12:10 Β· 30 min STAGE 2 (500)

What this session covers

A talk that starts with a problem and ends up with an elegant implementation using Java’s records, sealed types and pattern matching. It’s all live coding!

Project Amber is bringing lot of exciting features to Java. Records, sealed types and many pattern matching features are few important ones. Sealed types and records are the mechanisms to create sum- and product-types respectively. These are two important forms of ADT (Algebraic Data Types). Using ADT along with pattern-matching, we can create APIs that are hard to misuse and create programs that are easier to read.

All in all, in the talk we start with a problem statement and a list of requirements and then we create an implementation step-by-step by introducing requirements one by one. While we do that we make use of records, sealed types and pattern matching in Java to create elegant solution with highly readable code.

World Congress 2024

Related talks

Open session

Modern Java

  • Ron Veen

    Java enthusiast and Special agent for Team Rockstars IT

Open session

Java's Project Loom & Co - the end for reactive programming?

  • Jan Weinschenker

    Architect and Senior Consultant

Open session

Speak, Code, Deploy: Transforming Developer Experience with Voice Commands

  • Sami Ekblad

    Developer Experience Lead

Open session

Architecture Antipattern

  • Andreas Voigt

    Pragmatic Software Philosopher

All sessions at this congress