You are here: Re: Best Coding Practice « PHP Programming Language « IT news, forums, messages
Re: Best Coding Practice

Posted by Jerry Stuckle on 08/28/07 01:09

Michael Fesser wrote:
> .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?
>

That there is very little information available on refactoring.

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

Oh God. You've never had to deal with legacy code and "deprecated"
functions, have you? Very much a complete PITA!

>> As to the Wikipedia page - I have no idea who wrote this page. Was it
>> the same person?
>
> Surely not.
>

Are you sure?

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

I'm saying Martin Fowler is not the last word on anything. He is one
person with one opinion. Just like anyone else.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация