Why getter and setter methods are evil (Allen Holub, 2003)
Don’t ask for the information you need to do the work; ask the object that has the information to do the work for you.
Replace “object” in the above statement with “context” and it’s still accurate. These Days Holub phrases this as “Ask for help, not information”.
A little bit earlier Andy Hunt and Dave Thomas talk about the “Tell don’t Ask” principle in:
The Art of Enbugging (pdf, IEEE Software January/February 2003) and
Tell, Don’t Ask
Martin Fowler summarizes his take in TellDontAsk
“Tell Don’t Ask” is a consequence of Responsibility-Driven Design.
Practicing Ruby: Responsibility-centric vs. data-centric design (2012)
- Objects tend to be highly cohesive around their behavior, because roles are defined by behavior, not data.
In “context-speak”:
Contexts tend to be highly cohesive around their capabilities.
Essentially, if your thinking is even somewhat rooted in the CRUD world your are going to have a hard time isolating contexts.