I have two methods meth1
and meth2
. meth1
takes in an input of a set set1
, returns a value, and also modifies set1
.
Now meth2
uses this set1
to compute another return value.
The issue I see with this code is that the set modification is implicit and would be missed by a coder who is not careful enough.
I could do all the operations in a single method, but the working of both the methods is different enough to put them in different methods. Also a single method would be very long.
So given that I have to use two methods here, what is the best way to avoid the implicit modifications? What is the best practise to deal with this situation?
Any pointers are highly appreciated.
Aucun commentaire:
Enregistrer un commentaire