Dennis Deems wrote:Also, I suggest creating a Color enum instead of hard-coding Strings.
Jk Robbins wrote:I see that you are also implying the use of the Decorator pattern.
One reason I'm storing all the data in a single object is so at the end I have 5 beans that can put in the request for the jsp.
Alexei Kaigorodov wrote:... create new method assignColor:
Junilu Lacar wrote:I think that's a big improvement. I'd take the refactoring further. MetricScorer base class or interface with score() method that returns SUCCESS, FAILED, IMPROVED, or OPEN. Then two subclasses: first subclass scores SUCCESS when value is below the goal, the second subclass scores SUCCESS when value is above the goal. This way, you're calling the same score() method, and the way the score() method behaves is based on which subclass you're actually calling. This is more OO, IMO.
Jk Robbins wrote:I removed the test for the "open/white" option and I initialize it to "OPEN" just to give it a default value in case any of the other values aren't present.