~/talk

Design Patterns: Head-first vs Emergent

TalkinItalianat phpday PUG Edition 2021 · on Thursday, 2021-03-18· [frontend-architecture]
slides:none on file

Compares using head‑first (apply patterns upfront) versus emergent design (let patterns arise via refactoring) and argues patterns should emerge from refactoring. Demonstrates refactoring a PHP 8 Formatter into CsvVisitor and XmlVisitor classes, adding a Visitor base class and a Visitable trait, using reflection and constructor property promotion, and replacing conditional explosion with double dispatch; runs tests after each step and shows fewer edits per new format and clearer responsibilities.

AI-written summary · about

  1. 0:00Design pattern intro
  2. 3:11Pattern misuse reasons
  3. 7:12Refactoring as evolution
  4. 14:51Refactoring example
  5. 35:35Natural Visitor use
  6. 46:34When to use patterns
  7. 47:17Q&A
  8. 56:22Closing
~/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.