|
Posted by Michael Fesser on 08/28/07 00:33
..oO(Jerry Stuckle)
>Michael Fesser wrote:
>> .oO(Jerry Stuckle)
>>
>>> But if you change the function name, parameter list and/or return value,
>>> you have to change all of the code calling it. This is NOT refactoring.
>>
>> http://en.wikipedia.org/wiki/Rename_Method
>>
>> http://www.refactoring.com/catalog/renameMethod.html
>>
>And that's where I disagree with the author of the refactoring site.
>But that's one person's opinion. Other people who have written about
>refactoring
>
>Changing the name of a function which is externally available is
>changing the behavior. It means changing every piece of code which
>calls the function.
IMHO it just depends on how you define "refactoring". In Martin Fowler's
"refactoring catalog" there are some more issues that might require a
tweaking of the calling code, it's not only the "rename method" thing.
>For instance, between Apache 1.x and 2.x, the Apache foundation changed
>some of the function calls. This causes problems with any modules which
>call those functions.
>
>By your argument, ZEND should change the fopen() call to be file_open().
> How much code would that affect?
True, but there are ways how to deal with issues like these, see below.
>Rather, they might change the code to make it more efficient and not
>change the function name. This is refactoring.
Agreed. But refactoring might be more. I don't think there's a strict
one-and-only definition.
>But the author is correct - there is very little information available
>on refactoring. In some ways the site is good. But in other ways it
>contains incorrect information.
What is correct?
In regard to this particular issue I read something like this on another
site: If a method's name has to be changed, the new method should be
added, while the old method should be kept - internally it should call
the new one and be marked as "deprecated" in the documentation. Sounds
like an acceptable way to me (and something I've already seen in many
projects).
>As to the Wikipedia page - I have no idea who wrote this page. Was it
>the same person?
Surely not.
>Or someone else without a good idea about it?
You think Fowler doesn't know what he's talking about? The Wikipedia
article was just a comment and a reference to his book/website.
Micha
Navigation:
[Reply to this message]
|