[2022 javaone] new java features simplified design patterns

Speakers: Miroslav Wegner and Benedikt Neumayr

For more see the table of contents

Byte code optimization

  • Inlining
  • Elimination
  • Scalarization

Design patterns

  • DRY don’t repeat yourself
  • Separation of concerns
  • CAP – two of three (consistency, availability, partition tolderance)

Creating objects

  • Factory vs Builder
  • Example of using a builder with a sealed class
  • Factory: List.of(…)
  • Switch expression to determine what to create in factory

Organizing code

  • Organize code around instantiated objects: Adapter, Flyweight
  • Spiterator is an adapter
  • IntegerCache is Flyweight

Enforcin behavior at runtime

  • Chain of responsibility, command, caching
  • Logger is chain of responsibility
  • Runnable and Callable are command


  • Thread pool pattern
  • Executors

My take

I liked the one line ”safe harbor” statement that anything could change. Nice link between patterns we’ve known forever and new (and old) classes. There was a good crowd. I wish they had a room vs being on the floor of the exhibit hall. I also wish it was longer (vs a 20 min session)

One thought on “[2022 javaone] new java features simplified design patterns

Leave a Reply

Your email address will not be published. Required fields are marked *