Michaël Michaud wrote:
>
> @Martin : Please, can you explain what immutability means for 
> coordinates. I see that x,y,z are public fields (and I remember I often 
> changed them via small scripts, especially the z value). But may be I 
> have no clear idea about immutability and its advantages.
>
>   

Well, it's pretty simple. If you have a tool that works by altering the 
ordinate values in a Coordinate, and you are using the "interned 
Coordinate" strategy, you are going to get bugs, since Geometrys will 
change unexpectedly when their shared Coordinate values are changed by 
someone else.

The public x,y,z in Coordinate were originally there for efficiency 
reasons.  Probably a bad idea. In fact, Coordinate should have simply 
been an interface.  But too late to change now!  However, an application 
like JUMP should make it a blanket policy that Coordinate values should 
never by changed.  Any other policy leads to insanity, IMO.

HTH - Martin

-- 
Martin Davis
Senior Technical Architect
Refractions Research, Inc.
(250) 383-3022


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to