I have a bean
Goal with some variables, constractors (with and without arguments) and getters / setters. And in another part of the project, I reuse the accessors and setters and I wonder if it's a good practice, because it does not look like that. I do not need to create a new object each time I have to change some fields of the object.
Here is how I reuse the object.
/ ** Physical functioning ** / System.out.println ("---- PHYSICAL ----"); Score score = new Score (node, responses, node, mapper, "physical_f_rawscore", "physical_f_score", "physical operation", true); addScores (score, null, 0); / ** Functioning role ** / System.out.println ("---- ROLE ----"); score.setRawscoreName ("role_f_rawscore"); score.setScoreName ("role_f_score"); score.setTitle ("operation role"); score.setType (true); addScores (score, null, 0);
Does not bother you
addScores method, this is not important.
As you can see, the variable
cartographer stay the same and I only need to change some of the variables of the class
I could create a method inside
Goal class to implement these changes without having to call accessors and setters multiple times.