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.

Related talks at this congress

Open session

World Congress 2024

July 18, 2024 Β· 10:10–10:40

STAGE 2 (500)

Modern Java

Ron Veen

Java enthusiast and Special agent for Team Rockstars IT

Ron Veen
Open session

World Congress 2024

July 19, 2024 Β· 13:40–14:10

STAGE 2 (500)

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

Jan Weinschenker

Architect and Senior Consultant

Jan Weinschenker
Open session

World Congress 2024

July 18, 2024 Β· 11:30–12:00

STAGE 3 (120)

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

Sami Ekblad

Developer Experience Lead

Sami Ekblad
Open session

World Congress 2024

July 18, 2024 Β· 10:50–11:20

STAGE 4 (500)

Architecture Antipattern

Andreas Voigt

Pragmatic Software Philosopher

Andreas Voigt
All sessions at this congress