Explanation on how "Tell, Don't Ask" is considered good OO
- by Pubby
This blogpost was posted on Hacker News with several upvotes. Coming from C++, most of these examples seem to go against what I've been taught.
Such as example #2:
Bad:
def check_for_overheating(system_monitor)
if system_monitor.temperature > 100
system_monitor.sound_alarms
end
end
versus good:
system_monitor.check_for_overheating
…