Tyler Young - Architecting GenServers for Testability
GenServers are one of the first and most powerful tools we reach for when dealing with state. Without intentional planning, though, it’s very easy for a GenServer to grow into a Big Ball of Mud that’s hard for the team to understand, painful to change, and almost impossible to test. In this very practical talk, we’ll dig into a handful of techniques for improving the testability of GenServer implementations and saving yourself from maintenance headaches. We’ll consider lessons from the object-oriented community, including things like dependency inversion and separation of pure functions from state manipulation. We’ll also dive boldly (some would say recklessly) into controversial topics like mocks and stubs. My goal is for attendees to leave with three or four concrete ideas they can implement in their codebase today that will pay dividends toward their team’s happiness and peace of mind for years to come.