Feed on
Posts
Comments
The DoubleDawgDare Series:

GeePawHill takes on a horrific smush of legacy code

– real, not rigged —

and refactors it towards art.

—-


Share

6 Responses to “DoubleDawgDare Series”

  1. Jeff Grigg says:

    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.

  2. Jeff Grigg says:

    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?)

  3. Jeff Grigg says:

    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!

  4. Jeff Grigg says:

    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

Leave a Reply

AWSOM Powered