ruby - Exceptions to the "Command-Query Separation" Rule? -
command-query separation "states every method should either command performs action, or query returns data caller, not both. in other words, asking question should not change answer."
a = [1, 2, 3] last = a.pop
here, in ruby, pop
command returns item popped off array.
this example of command and query within 1 method, , seems necessary so.
if case, code smell have method query command?
stack popping well-known exception cqs. martin fowler notes place break rule.
i in case it's not code smell, in general is code smell.
Comments
Post a Comment