This is near on philosophical.
In my project here I have a lot of classes depicting objects moving about in a 2D environment.
One class X has (for example) three attributes, a, b and c. If I change one attribute the other two are also influenced.
Here are two possibile approaches - which is the right one?
1. caller takes responsibility
and the caller does this :
!!! BUT !!! the caller must also determine how b and c
are modified by the change in a.
It is the caller's responsibility to make the appropriate changes.
------------------------ OR ---------------------------
2. the object being called takes responsibility
this way if the caller does :
then he is not given responsibility forall that calculating
!!! BUT !!!
if the caller does :
then a lot of code is being performed for nothing, namely
: make the appropriate changes in b and c
: make the appropriate changes in a and c
each way has advantages and disadvantages.
However, what is the real cool programmer direction?
Thanks muchly.