~/talk

Designing functional and fluent API: example of the Visitor Pattern

slides:none on file

Live coding shows an implementation of the Visitor pattern in Java that avoids mutating state or changing the object model by using lambdas, a Map<Class,Function> registry, and type-safe generics with a few explicit casts. It builds a fluent API (builder/initializer, chained for(type).execute(fn) calls) and a visitable factory that maps functions over an object graph, then reduces results with Collector + Stream reduction to produce joined strings or lists. The example compiles and runs, producing expected concatenated strings and lists.

AI-written summary · about

  1. 0:00Start
  2. 1:29Why the Visitor Pattern
  3. 17:17Composition over Inheritance
  4. 21:58Visitor Builder
  5. 22:57Create a Default Method on the Visitor Builder
  6. 26:00Create an Init Method
  7. 47:52Make Visible Default Method
  8. 49:46Accept Method
~/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.