[concurrency-interest] Good terminology for setting up effectively immutable objects?

Mark Thornton mthornton at optrak.co.uk
Mon Apr 28 16:46:15 EDT 2008

Matthias Ernst wrote:
> Hi,
> often I neither want a huge (number of) constructor(s) nor want to
> jump through hoops of using a Builder to guarantee final-ness of my
> object's dependencies but want to rely on effective immutability
> instead. I want to rely on my clients' common sense that anything that
> is not documented as changeable should not be changed during use. I.e.
> a number of setters that they may only call a) before starting to use
> the object and b) before publishing it to other threads.
While I have written this sort of code often enough, I can't avoid the
feeling that I should have used the builder pattern in most of the
cases. In fact all of them, should probably have been genuinely
immutable and not merely effectively immutable. Can we find a way to
make the builder pattern more palatable?

Mark Thornton

More information about the Concurrency-interest mailing list