Dear
java community,
Recently I'm confronted with one issue and I want to know your opinion about this.
ISSUE DESCRIPTION:
In one of my business tier class I had method register user:
According to new business rules I need to add 2 arguments to this methods (boolean isCustomBank and
String customBankName).
All arguments in method are mandatory and I need them in registration process. It is also possible that in future it would be needed to pass more arguments to registerUser method (according to changes in business logic).
POSSIBLE SOLUTIONS:
A) Create userContext (as map) and collect there some arguments that needed in registration process (it would be used not only in this method, so it also would contain some other arguments not needed in registration). Signature of this method would look like this:
Invocation would look like this:
And UserCostants:
B) Create userContext (as class � wrapper of map from previous solution) and collect there some arguments that needed in registration process (it would be used not only in this method, so it also would contain some other arguments not needed in registration). Signature of this method would look like this:
Wrapper class:
C) Create value object UserRegistrationData that would hold data ONLY for user registration method. Example of the signature:
And value object class:
D) Just add new arguments to method's signature:
E) your solution....
QUESTIONS:
I don't tell you my opinion and pros and cons because I want to know your independent opinion.
Which of these solutions are good and why do you think they are good?
Which of these solutions are bad and why do you think they are bad?
Thanks.