[cvs] [Wiki] changed: InstantiateApplicationObjectRefactoring
Jan Schneider
jan at horde.org
Tue Aug 15 14:54:42 PDT 2006
jan Tue, 15 Aug 2006 14:54:41 -0700
Modified page: http://wiki.horde.org/InstantiateApplicationObjectRefactoring
New Revision: 1.2
Change log: We won't do any major refactoring before Horde 4 which will be PHP 5
@@ -19,13 +19,12 @@
# If there is a global {{$flarg}} variable which is an instance of some kind of driver, rename it to {{$flarg_driver}}
# In {{lib/base.php}}, create a global {{$flarg}} which is an instance of {{Flarg::}}
# For each static method in {{Flarg::}}
# Find all calls of the method and replace {{Flarg::method()}} with {{$flarg->method()}}. (**Possible exception:** if the method is truly static, meaning it will always produce the same output given the same parameters, you might want to keep it static.)
- # Remove {{@static}} in phpdoc comment
# For each global variable ({{$flarg_driver}} is used as an example):
# Add a {{getDriver()}} method to {{Flarg::}}
# Make {{getDriver()}} return the global variable's value
- # FInd references to the global variable, and replace each with a call to {{$flarg->getDriver()}} (Note: With PHP4, you may need a temporary variable, since {{$flarg->getDriver()->foo()}} does not parse.)
+ # Find references to the global variable, and replace each with a call to {{$flarg->getDriver()}}
# When all references are replaced, do **one** of the following:
# Move initialization code for the value into the method
# Introduce a field, move initialization code into constructor
# Introduce a field which defaults to {{null}}, move initialization code into getter, but only execute when the field is {{null}} (Note, beware of introducing cycles.)
More information about the cvs
mailing list