commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Dunning <ted.dunn...@gmail.com>
Subject Re: [math] Mutable "Vector3D"
Date Fri, 24 Apr 2009 17:04:23 GMT
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.

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.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message