Hi,

I found some code in Fortress (specifically ContextBuilder) that uses 
chaining. ie code can look something like

ContextBuilder cb = ...;

cb.doX().doY().doZ();

Because all the methods return this. In many cases this is considered a 
problem because it hides problems relating to;
* synchronization
* resource management
etc.

While those don't cover our situation I still consider it a bad practice 
because mutators/accessors should be sideeffect free IMO. WOuld anyone object 
if I made all those methods not return this? So the code would end up looking 
like

ContextBuilder cb = ...;

cb.doX();
cb.doY();
cb.doZ();

-- 
Cheers,

Peter Donald
He strains to hear a whisper who refuses to hear a shout.


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@;jakarta.apache.org>

Reply via email to