~/talk

Java Design Patterns 2022

links:none on file
slides:none on file

Modernizes GoF patterns for Java 2022 by showing concrete rewrites and working code: uses Supplier<LocalDate> injection so tests can fake "today", provides a static factory of() instead of public constructors, replaces Strategy with lambdas and Stream.reduce, demonstrates Builder alternatives with records and currying, implements a tested tennis game using records, sealed interfaces and the new switch, advocates enum singletons, replaces classic Chain of Responsibility with reviewers returning Optionals and using Optional.stream + flatMap, and shows a decorator via wrap class; all examples compile and tests run green, repo linked on GitHub.

AI-written summary · about

  1. 0:00Start
  2. 2:38Goals
  3. 3:16Tdd Immutability
  4. 3:44Avoiding Side Effects
  5. 6:30Decorator Pattern
  6. 11:25Test a Static Method Factory
  7. 17:49Strategy Pattern
  8. 20:57Strategy Pattern Problem
  9. 22:59Builder Pattern
  10. 25:10Replace Constructor with Builder
  11. 28:25Reference Pipeline
  12. 32:57Singleton
  13. 33:37Singletons
  14. 34:43Disadvantages
  15. 35:45Create a Singleton as an Enum
  16. 36:24State Pattern
  17. 37:18Off State
  18. 49:56Result Game
  19. 51:17Chain of Responsibility
  20. 52:03Carfax
  21. 57:57The Adapter Pattern
  22. 59:02Adapter Pattern
  23. 1:00:33Wrap Class and Wrap Methods
  24. 1:01:05Refactoring Strategies
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.