I'm kind of embarrassed to ask this, but I don't get it, so I'll just put it out there...
I'm not sure I get what's M, what's V, and what's C in some situations. For instance, take a typical data-driven app: Enter the area, see a search screen, submit it and get a record list back. Some areas have only a few records, so there's no search screen; all recs are always shown as soon as you enter the area. Some areas have several different search screens. How does this typical set of scenarios get put together in an MVC world? for instance: The controller gets the user's employees.list request, and detects that the submit btn wasn't clicked, so it calls employees.view.show_search. User submits that back to the controller, which now sees that the search has been submitted, so it calls employees.model.do_query, then employees.view.show_list. Or does the controller always blindly call the model and the view; the model detects that it shouldn't query because the submit btn wasn't pressed, and the view detects that no query was run, so it should show the search screen not the result list? Now suppose there's no search in the departments area. Does the departments controller know that itself? I'd think so, in the sense that it's the decision maker. But what if that's an attribute of the web gui view only (the email-driven version requires searching in every area, say). Should the view own the decision in that case? Or maybe every possible view of this area acts this way, so it's really an overall business rule that belongs in the model. Is it right that these decisions get made in different parts of the app, depending on how universally they apply? Or maybe the link to the employees area goes to .show_search, which submits to .show_list, and the one to departments goes directly to .show_list? Doesn't seem right to have to change all links to the area if its behavior changes. Suppose there's a basic search, with an Advanced btn on it, and maybe a user pref to say which they want to see first. Is that a view thing, so the view itself decides which actual form to use under which circumstances? Or does the controller make that decision, evaluating the browser request and the user pref and calling different methods of the view? What happens if the query finds no records? Does the controller check the number of rows found, and call either empoyees.view.show_list or employees.view.show_search? Or does the view itself decide to show the search or the result list? Can anyone help me get a handle on how these kinds of decisions are typically divided up between M, V, and C? Am I being clear here? A complete goober? Thanks, Dave Merrill ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]
