This is a question about the best programming methods, I did not know how to express the question in the name, sorry, here we go.
I had a method in the dispatcher or controller as follows:
public boolean myMethod(Param1 param1);
And, since the change is in the application, I had to redefine it like this because it calls another method that needs param2 and param3:
public boolean myMethod(Param1 param1, Param2 param2, Param3 param3);
Now I understand that a method with 3 parameters is "always" (at the moment, maybe there is a change in the future, and I need to call it with non-zero parameters) it will be called with param2=null and param3=null , therefore in the implementation of the 1st The method I did:
public boolean myMethod(Param1 param1) { return this.myMethod(param1, null, null); } public boolean myMethod(Param1 param1, Param2 param2, Param3 param3) { }
Thus, the call to the Manager method and the original method:
boolean isTrue = myManager.myMethod(param1);
This is one option, another option is to pass null parameters from the call:
boolean isTrue = myManager.myMethod(param1, null, null);
And let there be only one method in my Manager:
public boolean myMethod(Param1 param1, Param2 param2, Param3 param3);
So the real questions are: what is the best way to talk about best practices? Is it wrong if in the tha Manager implementation I overload the method and call it with zero parameters?
Thanks in advance!
Hey.