Designing Classes with Controlled Cross-Context Dependencies Using a Preview Feature
summary
Shows how to obtain context-specific behavior by swapping concrete dependency bindings: admin preview routes use a ProductPreviewRepository that merges DB product rows with key-value preview drafts, while public pages use the normal repository. Uses Slim and PHP-DI (RDI-style modules) and Graphviz to visualize object graphs, demonstrates making dependencies one-directional (admin depends on public logic), reuses price-calculation classes so preview price recalculations work without changing preview code, and outlines routing or entry-point switching as deployment options.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 1:05Talk overview
- 3:15Web app contexts
- 5:28Dependency design principles
- 6:55User context implementation
- 8:30Admin preview implementation
- 10:35Dependency comparison
- 12:20Sale feature extension
- 14:22Startup configuration
- 16:51Flexible routing
- 19:19Documenting object graphs
- 20:45Best practices
- 22:30Q&A
