From: Tony B. <to...@to...> - 2003-03-05 05:08:11
|
This is a lengthy email but it is important as I have put a bit of thought into this and would appreciate any thoughts. Generally speaking I am happy with the code in Phrame. Initially I have this one big problem. In the example provided, index.php includes all the actions needed (only one in this case). This will unnecessarily load code that is not really needed to process the current request. With Java you have then handy 'import' statement. We need to mimic that as close as we can. Instead consider these options: 1) Since we have _TYPE, you could assume that there is a PHP file with that name. So, in our example you have: $mappings[_ACTION_FORMS]['form'][_TYPE] = 'CalcForm'; From this you could assume that CalcForm.php exists so in the ActionController simply do this: require_once($mappings[_ACTION_FORMS]['form'][_TYPE] . '.php'); NOTE: this may require a new attribute _PATH in the mappings to indicate the exact path where the forms or actions could be found. 2) Add a new attribute, _PHP_FILE, which would hold the name of the php file for that form or action. Next up is the ActionController I need to spend some quality time with this code. I'm not really understanding all the code fully and until I implement my own example it probably won't make sense. I will do this tomorrow and shoot back any questions. Finally, I have modified all the Phrame source code to be compliant with PEAR coding standards. Here are some items consistently wrong: 1) PHPDoc comments missing. I added all that I could 2) class variables and method that should be private should have underscore '_' as prefix (e.g. var $_myPrivateVar or function _myPrivateMethod). This let's us quickly identify what is private even though PHP won't enforce it. 3) PEAR requires tabs in code to be the equivalent of 4 spaces. This may be a pain in the rear but trust me, PEAR won't take them any other way. I fixed this already but this is something other should note. 4) Some other minor things... Use: Function foo() { } NOT: function foo() { } OR function foo() {} -- Tony Bibbs "I guess you have to remember that those who don't to...@to... hunt or fish often see those of us who do as harmlessly strange and sort of amusing. When you think about it, that might be a fair assessment." --Unknown |