Name that refactoring: 1 - Version 2 14

Posted by Brett Schuchert Wed, 16 Dec 2009 07:43:00 GMT

Here is an update to the first name that refactoring based on feedback. How about this?

Step 0: Method with embedded dependency

Step 1:Extract method to move dependency to another method

Step 2: Subclass and override method with new code that does not have original dependency

So what do you think? Better or worse?

What about using the star in other image? In general, the star could represent the dependency we’re trying to get rid of.

Comments

Leave a response

  1. Avatar
    Markus Gärtner 28 minutes later:

    The star confuses me. In general the text helped a lot understanding the graphics. Overall, I think it’s comparable to the previous one.

  2. Avatar
    Alistair about 1 hour later:

    I have to agree with Markus that the star is a little confusing but once you have the legend, i.e. a worked example, the graphics are superb. I really like the format you’ve come up with. Very subtle but very easy to understand once you know how to interpret them. Bit like Feynman Diagrams for code!

  3. Avatar
    Giorgio Sironi about 2 hours later:

    I think the star is confusing because there is no entity that corresponds to it in code: the lines are methods code, the second box is the subclass… The star is a dependency… uhm…

  4. Avatar
    Andreas Ebbert-Karroum about 4 hours later:

    I think we are now spoiled, because we know the first version and know what it should tell. Despite that, it’s definitely an improvement (I notice that methods are now grey boxes, and classes are black boxes :) ). I also like that you use waves instead of lines, to make the point that these are different lines of code.

    The star … the intention is good, but maybe there’s a symbol which is understood as an external system. Maybe the problem is, that a star is generally assumed to be something good, while here you want to get rid of it.

  5. Avatar
    Cyrille Martraire about 5 hours later:

    I like the star as a fresh symbol with no other prior meaning to consistently refer to a worrying dependency.

    However the star has a positive connotation to me, as opposed to the dependency (what about an exclamation mark somewhere?)

    On the other hand, the template method pattern is not self-explanatory enough.

  6. Avatar
    zvolkov about 6 hours later:

    too complex

  7. Avatar
    r. about 8 hours later:

    As others, I prefer the “cloud” version. Maybe you could try a “weather” cloud even with some thunder to underline the potential “Chaos” out there. Or a pictogram that can easily identify itself as such.

  8. Avatar
    Markus Ewald about 8 hours later:

    I liked the cloud better. The star is a sharp, well-defined shape, so I associate it with a single method call or something trivial.

    The cloud better expressed that the classes (in example 2) or the method (in example 1) were accessing some ominous dependency, like methods from some OS-provided API.

  9. Avatar
    Andrew Traviss about 8 hours later:

    If you’re representing a dependency, maybe a knot or a chain link would be more obvious iconography?

  10. Avatar
    Jason Y about 10 hours later:

    Since you explained what the star means and gave a caption for each image, it is clear to me.

  11. Avatar
    Steve Py about 19 hours later:

    Perhaps consider something like a flag, and work it into the description. I.e. “We have flagged a dependency that we want to isolate.”

  12. Avatar
    b 13 days later:

    If you are doing this for training purposes, the second is better. Text and basic graphics help. I think the star icon can be improved. The chain or link as mentioned above or another box to continue your existing symbols

  13. Avatar
    Zen about 1 month later:

    I’d replace the star with a red exclamation point (!). It is often used to signify something bad, important or otherwise something to look out for. Difficult dependencies are absolutely something to look out for so I think the analogy would work. Hence showing you are now avoiding the exclamation point aka the bad thing.

  14. Avatar
    Professional CV Service about 1 month later:

    I think that it is better to do like this.

Comments