About the MVC pattern in major PHP frameworks and Sitepoint's forum stickied thread
Well I've been trying to implement my own MVC framework for a while now. I've been following a structure quite similar to PHP major frameworks such as Zend, Symfony, CakePHP, Codeigniter and Yii, which uses a front controller that delegates its actions to those app controllers. However, after I viewed this thread on sitepoint, I am a bit confused:
As you can see, the design seems quite different. In major frameworks, each action is defined as methods inside an app controller such as public function edit() or public function editAction(), while in the thread from sitepoint, each action is a command class like Class UserAddCommand and Class UserEditCommand. For this, I have a few questions to ask:
1. Is it a better approach to define each action as a command class/object(sitepoint's example), or as a method inside a controller(like php major frameworks)? Sitepoint's example is more similar to the way Martin Fowler originally illustrated the controller pattern, but why isnt it widely adopted in php frameworks?
2. What is the difference between an app controller in CakePHP/Codeigniter and an application controller as defined by Martin Fowler? Are they the same thing? They seem to be doing different tasks, though both are referred to as app controllers...
3. Sitepoint's MVC example also has each view defined as view classes(such as Class UserAddView and Class UserEditView), in which the html code is generated from PHP script. Is it a better practice than to embed PHP in html as what major frameworks are doing?