Page 1 of 1

Project Modication Blues

Posted: Thu May 26, 2005 10:51 pm
by harrisonad
Hello,
I have a common function that is used by almost all scripts in my project.
We all know that, OOP in mind, I can change the contents of this function without affecting the outside world. But what if I want to change the order and number of its arguments. Like for example, it used to accept $namestr as argument -

Code: Select all

function foo($name){
. Eventually, I analyzed that it must also accept '$address' argument -

Code: Select all

function foo($namestr,$address){
.
If I do so, then I have to change all function calls (ei.about an hour) to whatever appropriate. This is a waste of time I guess.

In your opinion, what is the best way of dealing with this situation?

Thank you, masters, in advance.

Posted: Thu May 26, 2005 11:22 pm
by Burrito
set a default value for your second argument and then you don't HAVE to pass anything to it.

if you need to pass stuff on all of your calls, then unfortunately you're going to have to modify them.

an extended find and replace with most editors should do it pretty quickly though...