>>Andrew Moulden wrote:
>> If you're writing stuff for Java servlets then you can write the
>> crappiest code imaginable...
>Roberto Speranza wrote in reply:
>This sounds like you are insinuating that I write crappy Java code and I
>don't notice it because I only program servlets.
I wasn't suggesting that and I apologise if my lack of exact grammar
gave you that impression. I was using 'you're' in the sense of 'one is'
or 'I am' or 'a programmer is'.
Going back to the original example:
--------------START EXAMPLE---------------
public TCBSplinePathInterpolator(Alpha alpha, TCBKeyFrame keys[]) {
(stuff deleted)
// Make space for a leading and trailing key frame in addition to
// the keys passed in
keyFrames = new TCBKeyFrame[keysLength+2];
keyFrames[0] = new TCBKeyFrame();
keyFrames[0] = keys[0];
for (int i = 1; i < keysLength+1; i++) {
keyFrames[i] = new TCBKeyFrame();
keyFrames[i] = keys[i-1];
}
keyFrames[keysLength+1] = new TCBKeyFrame();
keyFrames[keysLength+1] = keys[keysLength-1];
---------------END EXAMPLE------------------
>Roberto Speranza wrote:
>Actually, this is another case of copying supplied objects as mentioned
>above. The only weird thing I see there isn't that they just didn't put
>everything in the loop but that is probably an optimization to deal with
>empty keyframe lists.
>>Andrew Moulden wrote:
>>With all due respect, I recommend you read the example I gave again V_E_R_Y
>> S_L_O_W_L_Y and then make your observations.
>Roberto Speranza wrote:
>I read it over slowly enough, thanks. The code is duplicating >TCBKeyFrame objects.
>From one point of view, I agree it is wasteful.
I am sorry but you are wrong. The code is *not* duplicating TCBKeyFrame
objects but the programmer *thinks* it is (and so do you) and this is
the point I am trying to make. It demonstrates a fundamental
misunderstanding of how object assignment works in Java, and there are
examples of this error of principle throughout the (published) J3D code.
The whole purpose of my original posting was to express the concern that
if such basic programming errors are being made within the core J3D
source, and remain there, then J3D will be saddled with a permanent
performance hit. If the source was publicly released, such errors would
be quickly expunged and we would have a more solid API.
Andrew Moulden
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".