Understanding the BOOS, "Don't ask tell" from a talk at GORUCO 2012
✓ Published0🌍 Public
Aafbroman
Last edited Aug 3, 2012
Created on Sep 21, 2012
This example demonstrates the "Tell, Don't Ask" principle in Ruby by showing a chain of listener objects that pass a successful print notification through Mailer, Pinger, and other handlers. The code defines classes using Struct.new to hold a single listener reference, and each class’s print_successful method prints a status message before delegating to the next listener. The visualization shows how Printer initiates the chain by calling print!, and each subsequent handler receives the notification, logs its action, and forwards the message down the pipeline until the final listener is reached. The rendering relies purely on console output via puts and sleep for timing, with no graphical data visualization libraries involved.
AI-generated description