As for clean design, which is preferable?
1) Passing an object, say, to another method of the class that will directly manipulate the attributes of the passed object.
Inside class A ...
B.doStuff(this);
2) Instead, pass the attributes of the object and either assign a return back to the attributes, or pass by reference.
Inside class A ...
this.var1 = B.doStuff(this.var1);
The disadvantage of the first method is the ambiguity, it is not clear that B changes to A. The disadvantage of the second method is that if the attributes are not passed using references / pointers, then you need to return an array, and it will also be a longer function call if you finish passing the set attributes. I assume that the right choice depends on the situation, but are there any other advantages / disadvantages that anyone else can come up with before deciding?
: , ( ), , . , , , B A, B , A . , , , , .