Quote Originally Posted by phantomotap View Post
It depends on what the function does, what operations are involved, and what error handling is necessary.

A function operating on native types (any operations that do not generate errors) can probably just return instances of those types (values).

A function counting matches with a predicate may impose requirements (no errors) on the operations involved.

A function likely to fail during normal execution should probably not mutate parameters unless absolutely necessary.
That's an interesting and informative set of criteria -- thanks for posting it. As usual, the right thing to do depends on the situation, and this is only learned by experience (or being exposed to it by people who have such experience).

In my experience, good designs tend to be created by good designers, and this is a very ephemeral thing to define. It has partially to do with intelligence, a great deal to do with experience, and somewhat to do with luck. In any case, simply asking the question is a sign that you're willing to learn (painfully, in some cases) how to do it right.