Sean,
I agree it could lead to confusion, but it would be more surprising
(to me) to have normalize() and rotate(double theta) inconsistent with
add, etc. within MutableDouble2D. Usually I would pick either one or
the other, and so internal consistency is slightly more valuable to
me. Having no side effects would be more functional-like, but this is
Java.. *shrug* Main thing is to be clear in the docs. Anyone else have
any thoughts?
Dr Matthew Berryman
Defence and Systems Institute
SPRI Building
University of South Australia
Mawson Lakes SA 5095
t +61 8 8302 5882
f +61 8 8302 5344
m +61 413 458 594
CRICOS Provider Number: 00121B
On 29/10/2009, at 8:42 PM, Sean Luke wrote:
> So the problem with (B) is this. Let's say that M (and M0) is a
> MutableDouble2D and D (and D0) is a Double2D.
>
> If I say:
>
> Double2D Q = D.add(M)
> or
> Double2D Q = D.add(D0)
>
> This will put into Q the result of D+M (or D+D0), but neither D, nor
> D0, nor M will be modified.
>
> However if I say
>
> MutableDouble2D Q = M.add(D)
> or
> MutableDouble2D Q = M.add(M0)
>
> This will put into Q the result of D+M (or M0+M), but also set M to
> that result.
>
> I would imagine this would be... fairly surprising. Wouldn't you?
> That's what concerns me.
>
> Sean
>
>
> On Oct 29, 2009, at 10:49 AM, Matthew Berryman wrote:
>
>> Sean,
>>
>> I agree with your points on (B), and this would be personally least
>> surprising to me, given the other existing methods (it is mutable,
>> after all :)
>> I'm just a sample size of one, though.
>>
>> Cheers,
>> Dr Matthew Berryman
>> Defence and Systems Institute
>> SPRI Building
>> University of South Australia
>> Mawson Lakes SA 5095
>> t +61 8 8302 5882
>> f +61 8 8302 5344
>> m +61 413 458 594
>> CRICOS Provider Number: 00121B
>>
>>
>>
>> On 29/10/2009, at 7:40 PM, Sean Luke wrote:
>>
>>> Not hearing a peep from the peanut gallery :-( I'm inclined to make
>>> the (B) modifications. Going once, going twice?
>>>
>>> Sean
>>>
|