OO MVC controllers
Posted: Sat Feb 03, 2007 11:36 pm
I'm not sure I see the use in having a class contain X number of functions for each action a controller might have...
Something like Zend might look like:
I find that awefully wasteful for something which is automated...
I mean, your already getting a system which opens the controller file based on controller/action pairs...and the function is invoked...so why not modularize one step further and have the actions stored in seperate files seeing how you will unlikely have a updateAction and a insertAction invoked in the same request...
Why not:
Controller:Action
============
profile/insert
This way only the controller action which is actually going to be used/executed get's parsed.
Yes you would more work in terms of file management but you could organize each action into directories instead of classes.
Are there any instances where one might want a base action controller which would be later derived from - in which case requiring OOP? Specific examples please...
Assume a front controller is being used...so many of the reuse practices when using a page controller have already been solved using the FC pattern...this is why I wanted specific examples???
Something like Zend might look like:
Code: Select all
class aboutController{
function indexAction();
function saveAction();
function updateAction();
...
}I mean, your already getting a system which opens the controller file based on controller/action pairs...and the function is invoked...so why not modularize one step further and have the actions stored in seperate files seeing how you will unlikely have a updateAction and a insertAction invoked in the same request...
Why not:
Controller:Action
============
profile/insert
Code: Select all
profile.module.php -> File to load
function profile_insert() -> Function to invoke (profile_* added for namespace reasons)Yes you would more work in terms of file management but you could organize each action into directories instead of classes.
Are there any instances where one might want a base action controller which would be later derived from - in which case requiring OOP? Specific examples please...
Assume a front controller is being used...so many of the reuse practices when using a page controller have already been solved using the FC pattern...this is why I wanted specific examples???