Mechanical coffee machines are amazing! You drop in a coin, listen for the clink, make a selection, and the machine springs to life, hissing, clicking, and whirring. Then the complex mechanical ballet ends, splashing that glorious, aromatic, black liquid into the cup. Ah! C’est magnifique!
There’s just one problem. Our customers also want soup! And, our machine is not extensible. So, we have a choice: we can add to the complexity of our machine by jamming in a new dispenser with each new request; or, we can pause to make our machine more extensible before development slows to a halt.
That's the abstract for A Brewer's Guide to Filtering out Complexity and Churn, the talk Fito von Zastrow and I gave at RubyConf Mini in Providence, back in 2022. We also gave an extended (and unrecorded vendor talk) version of the talk at RailsConf 2023 in Atlanta.
Since RubyConf Mini, Fito and I have begun blogging about the topic in The Coffee Machine Series. We've written the first few articles. But, there's a lot more to come. Here's where we are and where we might go:
- What is complexity?
- As a patron, I want coffee
- As a patron, I want tea
- As a patron, I might want condiments
- As a patron, I want cocoa
- Adds cocoa
- Adds whipped cream
- A note about naming
- It's not really a CoffeeMachine any more, is it?
- Is it time to refactor?
- Review complexity over time
- Finding the right abstraction
- Rehydrate the code
- Extract polymorphic classes using the SRP
- Introducing the factory & null object patterns
- Extracts BeverageFactory class
- Adds NullBeverage class
- Refactors factory to use convention
- Self-registration and the OCP
- Introducing self-registration into the factory
- Are we done refactoring?
- Revisit complexity
- As a patron, I want soup
- Adds tomato soup
- Adds pumpkin bisque
- Adds miso soup
- Yeah, but does it scale?
- Complexity v. Churn
- The three C's of code quality