From: Arnold C. <arn...@ya...> - 2003-03-06 15:13:39
|
I do prefer having a single mechanism for handling views (a special action). I did a lot of research determining if push or pull mvc would be a better approach to take and found this article: http://www.ingrid.org/jajakarta/turbine/en/turbine/turbine-2/pullmodel.html I'm not sure about the idea of combining actions with forms. The original idea behind keeping them separate is that the action mechanism (the command pattern) should only be concerned with handling command logic. Keeping the forms separate from this enabled the framework to validate form data before an action was even involved in the process of handling the request and allowed for form reuse between actions. I like the idea of creating a secure action. We should also create other useful base actions such as a DispatchAction that would allow the use of ACID methods in a single action through the use of the _PARAMETER action mapping attribute. There are many places that refactoring could happen and I agree that we should implement the use of factories for the actions, mappings, forms, and forwards. The use of the session to hold the controller is not required and I think changing it to use a static variable (the singleton pattern) is a great idea. Arnold --- Tony Bibbs <to...@to...> wrote: > If you ask me, the display of a view or form is > nothing more than a > special action, right? > > If so, why not just treat it as such? The > controller should only be > concerned with building actions, executing them and > handling any resulting > action mappings. In fact I think you could refactor > things a bit in > Phrame to make more sense: > > Action: Abstract action class (already exists) > > Secure Action: Inherits from Action, is also > abstract but has some > security related methods (new) > > Form: again, this is an action that can inherit from > Action or Secure > action. Only difference is the perform() method > would show the form and > you'd have a validate() method that would validate > the form. (new but code > exists in other existing objects) > > From the developers perspective you now only edit > one action to modify the > form and tweak the validation which, IMHO, is a huge > time saver. > > Please note this is just a matter of refactoring the > current code. I > don't think this would require any new code...just a > matter of moving > things around a bit. > > Also, I think you should think of adding a > ActionFactory object. This > implements the traditional Gang of Four Factory > pattern and only generates > actions based on the request. Thus your > ActionController would have > something like: > > $action =& ActionFactory::getAction($_REQUEST); > $action->perform(); > > If you take my suggestion and make the form a > special action it works the > same for business logic or view logic... > > Thoughts? Concerns? Arnold, you alive? I'm > worried I may have turned > you off... > > --Tony > > On Wed, 5 Mar 2003, Jason Sweat wrote: > > > It is not nescesary. The only thing I keep in the > $_SESSION is the error list. > > In my implementations I have not added it to the > session. Here is an example > > PHP script from one of my implementations. There > is some other neat stuff I > > have been waiting to see the next version of > Phrame for to see if my changes > > are compatible, like the $controller->ShowView() > method. > > > > <?php > > /** > > * depot inventory dashboard web site > > * > > * implemented using the MVC pattern, using Phrame > > > * > > * @author Jason E. Sweat > > * @since 2003-02-13 > > * @package Depot > > * @version > > * <pre> > > * $Log: depot_inv.php,v $ > > * Revision 1.3 2003/02/13 19:09:39 sweatje > > * inital start at conversion to MVC framework > > * > > * </pre> > > * > > */ > > error_reporting(E_ALL); > > > > /** > > * common definitions for this applicaiton > > * > > * includes the mappings, options and errorHandler > function from the phrame > > sample application > > */ > > require_once('depot_inv_setup.php'); > > > > //initialize error handler > > if (!array_key_exists(_ERRORS, $_SESSION)) { > > $go_errors = new Stack(); > > $_SESSION[_ERRORS] = $go_errors; > > } > > > > $go_controller = new > DepotInvController($go_map->GetOptions()); > > > > if (array_key_exists(_ACTION, $_REQUEST)) { > > //release control to controller for further > processing > > > $go_controller->Process($go_map->GetMappings(), > $_REQUEST); > > } else { > > //release control to controller for displaying > a view > > $go_controller->ShowView(); > > exit; > > } > > > > //debugging code > > trigger_error('Action with no redirect?'); > > if (true) { > > print "<pre>"; > > var_dump($_SESSION); > > } > > > > > > ?> > > > > > > > > > > --- Tony Bibbs <to...@to...> wrote: > > > Is it really necessary to stick the controller > in the session? I'm trying > > > to see the value in jamming a potentially large > amount of stuff into a > > > session which, I think, unnecessarily hogs > server resources. Is the > > > initialization overhead of the controller really > that bad? Also, if it > > > is, why put it in each user's session? Why not > make it a static variable? > > > > > > I hope someone responds to my earlier posts, I'm > ready to start tweaking > > > things but would like some feedback first. > > > > > > -- > > > 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 > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: Etnus, makers > of TotalView, The debugger > > > for complex code. Debugging C/C++ programs can > leave you feeling lost and > > > disoriented. TotalView can help you find your > way. Available on major UNIX > > > and Linux platforms. Try it free. www.etnus.com > > > _______________________________________________ > > > Phrame-devel mailing list > > > Phr...@li... > > > > https://lists.sourceforge.net/lists/listinfo/phrame-devel > > > > > > __________________________________________________ > > Do you Yahoo!? > > Yahoo! Tax Center - forms, calculators, tips, more > > http://taxes.yahoo.com/ > > > > -- > 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 > > > > === message truncated === __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ |