19. Delegate Responsibility to Client Code
“Put the decision for how to handle
test cases in the hands of the code
best qualified to determine the
appropriate response.”
20. ● Intent of the method
is obscured
● Calling code is not
self-documenting
● Little flexibility.
What if we want
more than 2 ways to
handle errors?
Passing data/flags
21. ● Pass policies as
block/proc/lambda
objects
● Stop handling edge
cases from obfuscating
the method’s intent
● Flexibility - let’s the
client code handle
decision making
Passing Policies