> Hi -
>
> What's the general contract/expectations for passing objects? Is the method
> receiving the reference expected to copy the object if it might modify it?
If the object doesn't want to be modified, then it should simply not allow
that.
> Let's say a method receives a buffer and needs to modify that buffer. Is it
> an okay practice to note in the javadoc that the caller needs to provide a
> disposable data buffer?
If the object is modifiable, then IMHO it would be good to know what a method
does to it.
> reverseBuffer(capitalizeBuffer(padBuffer(someBuffer))) generates a lot of
> waste if each method is expected to work with a scratch copy.
Luckily in the JVM all waste can be cleaned up.
> I know there's no language rules here. But I'm curious how people handle
> the issue. Are there any guidelines?
As a non-professional, I usually figure it out as I go along. Finishing your
first design is a good time to start your second design. :)