A Series of Fortunate Events
What is an event really? How can you best describe an event in your code? What types of events are there, and how do you decide whether or not to implement something as an event?
In this talk we start with a straightforward command-only piece of code. We extract events from it and start moving the event handling code out, trying different design patterns on the way. First we try Observer. Then we introduce event data, event handlers and a Mediator between our code and the event handlers. Finally we pick a well-known event dispatcher implementation (the Symfony EventDispatcher) and see how it uses the Chain of Responsibility design pattern to control the entire flow of a web application request.
In the end I will answer some burning questions like: is it safe to use events all over the place and rely on event handlers to do some really important stuff? How do I overcome the indirection in my event-driven code? And how can I quickly find out what happens where?
- 01/23/2015 PHPBenelux, Antwerp website feedback
- 11/14/2014 November Camp 2014, Stockholm website slides feedback
- 10/2/2014 DrupalCon EU, Amsterdam conference video
- 9/18/2014 Drupal Café, Utrecht (NL) website
Great intro into events by @matthiasnoback! Wish I saw this talk when I started using events. #phpbnl15 pic.twitter.com/KgyAhJkrLg— Tim de Pater (@trafex) January 23, 2015