commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [math] Mutable "Vector3D"
Date Fri, 24 Apr 2009 17:39:57 GMT
On 24/04/2009, Ted Dunning <ted.dunning@gmail.com> wrote:
> With small objects like this, it is generally a very clear win to have
>  immutable objects.
>
>  With larger matrix and vector objects, the advantage is not so clear.  It is
>  often very nice to mutate large matrices in place via views.  This usually
>  happens in the context of a single class such as a decomposition method so a
>  fruitful approach often is to allow a programmer to make a mutable copy that
>  is manipulated for a while destructively and then marked as immutable when
>  it is exposed to the outside world.

How does that work?
Do threads have to get a shared read-lock or exclusive write-lock on the object?

>
>  On Fri, Apr 24, 2009 at 8:09 AM, Eric Bowman <ebowman@boboco.ie> wrote:
>
>  > luc.maisonobe@free.fr wrote:
>  > > The points above are not theoretical one. Vector3D was mutable and it
>  > > cost us weeks of works at that time to track difficult bugs in a
>
> > > complex application. ...
>
> >
>  > +1
>  >
>  > The cognitive overhead of dealing with the possibility of side effects
>  > is a serious brain drain, particularly on such a fundamental atom.
>  > Embrace immutability, and rejoice.
>  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message