Explain the different layers of a modern MVC app here. What are considered best practices?
Note: not sure what overlap there is with Application Flow. Maybe just start writing down one story and see how it can be broken up
MVC specifies that the application code is divided in to three sepearte parts -- in two layers. The Model is in a lower Domain layer that should be independent from the other parts. The View and Controller are both in the Presentation layer. The Controllers stay focused just on request processing and program flow. The View is focused on only building the response that is sent back to browser. All the "business" or "domain" code is separated out into a separate, lower Model layer with the goal of keeping it independent from the request/response and program flow code. This scheme has proven to make larger, more complex application easier for multiple programmers to maintain.
The Front Controller and Action Controller patterns are a commonly used in implementatiing of the Controller part of the Model-View-Controller pattern. A Controller is a specific piece of code that deals with request processing and program flow, and providing support code to deal with those things (e.g., forwards). There are three main kinds of Controllers related to this discussion.
Skeleton implements the Front and Action Controller patterns. The Front Controller class is A_Controller_Front. It is instantiated once in the boostrap script and dispatches an Action Controler based on values in the Request or, absent that, defaults in the Configuration.
Action Controllers can be plain PHP classes or they can extend the A_Controller_Action class to provide additional commmon functionality. Or you can use you own base Controller class, since no base class is required. In addition, there is a A_Controller_Action_Dispatch class that provides the additional functionality of pre and post filters.
And Action Controller is implemented by creating a file with the same name as the name used to request it. So a "login" Controller would be implemented as:
<?php
class login {
function index($locator) {
}
}
class login extends A_Controller_Action {
function index($locator) {
}
}
class login extends MyBaseController {
function index($locator) {
}
}