I notice that…
Validation -> processValidationPlural
Validations -> processValidationAnnotationSingular
(annotation name -> goes to -> method name)
So “Validation” is Plural, while “ValidationSSS” is Singular?
To be more consistent with the other methods, I would probably call them “processValidation” and “processValidations”.
_ _ _
I noticed that the code in the “processValidationAnnotationSingular” method contains copies of the code in nearly all of the other “process*” methods. (Everything except DoubleRangeFieldValidator.) I would suggest deleting the unnecessary null checks from that code, and then for each “process*Validator” method, extract all the lines except the first into a method of the same name, and then inline the original method (back into the processSingleAnnotation method). I think you’ll like the effect this will have on the processValidationAnnotationSingular/processValidations method.
_ _ _
Looking through the class, I too have a very strong feeling that I would create a wrapper class for each annotation class, give them a common abstract base class, and then use reflection to find and create them and dispatch to them.
Sincere thanks for the “Eclipse Java Code Formatter Settings” file.
A suggestion: When I change “Line Wrapping -> General settings -> Maximum line width” to something larger than 80, I also change “Comments -> Maximum line with for comments” to match. (But maybe you want to keep comments shorter so they’ll be more readable?)
Re: “DoubleDawgDare 5: Pick, Pick, Pick”
I notice that…
Validation -> processValidationPlural
Validations -> processValidationAnnotationSingular
(annotation name -> goes to -> method name)
So “Validation” is Plural, while “ValidationSSS” is Singular?
To be more consistent with the other methods, I would probably call them “processValidation” and “processValidations”.
_ _ _
I noticed that the code in the “processValidationAnnotationSingular” method contains copies of the code in nearly all of the other “process*” methods. (Everything except DoubleRangeFieldValidator.) I would suggest deleting the unnecessary null checks from that code, and then for each “process*Validator” method, extract all the lines except the first into a method of the same name, and then inline the original method (back into the processSingleAnnotation method). I think you’ll like the effect this will have on the processValidationAnnotationSingular/processValidations method.
_ _ _
Looking through the class, I too have a very strong feeling that I would create a wrapper class for each annotation class, give them a common abstract base class, and then use reflection to find and create them and dispatch to them.
Sincere thanks for the “Eclipse Java Code Formatter Settings” file.
A suggestion: When I change “Line Wrapping -> General settings -> Maximum line width” to something larger than 80, I also change “Comments -> Maximum line with for comments” to match. (But maybe you want to keep comments shorter so they’ll be more readable?)
Want to post a link to step #7 here?
http://anarchycreek.com/2010/03/30/doubledawgdare-7-one-spike-no-buffy/
It’s a great next step!
Thanks!
If this exercise gets you, the readers, excited, be sure to check out
http://refactormycode.com/
It’s a place where people ask for refactoring (and bug fixing) on a wide variety of small focused problems.
I’ve been making a few small contributions there.
– jeff
I haven’t been there for a while, but now that I’ve poked around there a bit I realize that there’s not much Java at http://refactormycode.com/
Part 8: http://anarchycreek.com/2011/07/23/doubledawgdare-8-one-giant-step/