>George:
>
>RE: Functional Cohesion
>
>Yes, indeed, a given method/procedure/function should do one, and only one, thing. That may not be the same as returning exactly one result, however.
>
>I'm doing some work that involves linear regression, which determines the "best" line to fit through a series of data points. A line is given by the formula
>
Y = A + B * X
>so the definition of this line actually requires two values (A and B), and invoking a routine to perform linear regression should indeed return both values.
>
James,
Returning multiple values isn't necessarily a bad thing if the values are related in some sense. In that case, I'd probably think that returning an object would be the best solution.
I've a simple rule. If you can completely describe what a function/procedure does without a conjunction, then it's cohesive.
What I was trying to get to here was not having a function/procedure do two different things.
George
Ubi caritas et amor, deus ibi est