Re: Ambiguous Refactoring Solution

Adam Sroka <[email protected]>
Newsgroups gmane.comp.programming.refactoring
Message-ID <[email protected]>
On Thu, Sep 24, 2009 at 5:24 PM, Richard <[email protected]> wrote:
>
>
>
> In article <[email protected]>,
>
> Adam Sroka <[email protected]> writes:
>
> > You repeatedly said "Do you write tests for [some] refactoring?" I do
> > not write tests for any refactoring. That is not /why/ I write tests.
> > I write tests to *prove* deterministically, that the code does what I
> > intend it to do.
>
> That's fine for new code development, but the whole context of this
> discussion is for legacy code, i.e. existing code that has no tests.
> We then discussed some refactoring choices and then the dogma of "no
> refactorings without tests!" came out and I raised some examples of
> scenarios where that dogma just doesn't make any sense. I also raised
> several examples of where the dogma is sometimes the right advice and
> sometimes not.
>
> I'm only saying that judgment and usefuleness (cost/benefit analysis)
> trumps dogma.

I agree, on its face, with the argument that judgment can help us to
determine when writing a test is useful. I object to the strawman
argument that you are presenting. If I have a huge pile of legacy
code, and I want to rename a method, do I need comprehensive automated
tests? Of course not.

However, if I have a huge pile of legacy code, and no automated tests,
what is renaming a method going to get me? If we go back to the
original topic of this thread, how is renaming a method going to
improve the design of a 613 line C++ class?

Call it dogma if you want, it doesn't hurt my feelings, but I'm
sticking with the assertion that the first, best thing we could do to
improve that class is to cover it with tests.


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/refactoring/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/refactoring/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.