Ruby Mediator
summary
Shows a concrete Ruby implementation: a Mediator class that registers devices and exposes lock_device / unlock_device methods which Tenant and Landlord call instead of calling Device directly. Example classes are Device, Tenant, Landlord with the mediator forwarding calls and invoking tenant/landlord notification methods. Demonstrates that renaming internal Device methods only requires changing the mediator (no other files), cuts testing surface and release time, and warns the mediator can become a God object if it grows too large.
AI-written summary · about
chapters (11)
- 0:00Introduction and speaker
- 0:51What are design patterns
- 3:11Problem with tight coupling
- 3:33Mediator design pattern explained
- 6:31Core components of mediator
- 8:43Benefits of mediator pattern
- 10:17Demo tight coupling issue
- 13:11Implementing mediator in Ruby
- 15:40Testing changes with mediator
- 16:47Potential drawbacks
- 17:09Recap and key takeaways








