While html and css would certainly be part of the View, and the database (MySQL, XML or any other way of holding data) would be part of the Model layer, I agree with Dave that php is not, strictly speaking, a Controller. I think that PHP (or ASP, or any server-side language) would more likely to be all three put together - it gets the data from the database, it handles application logic, and it can be used to write html directly into the page. It would in fact be possible to split all your php code into Model, View, and Controller classes, if you wanted to, use another class-based design pattern, or skip all of that altogether.
On the other hand, you might also simply split PHP into the View and Model components, and skip the Controller altogether. Or if you take a simple script that works in conjunction with a Flash application, PHP is more likely to be part of the Model and nothing else, since Flash would be handling presentation and logic. > -----Original Message----- > From: [email protected] [mailto:flashcoders- > [email protected]] On Behalf Of Dave Watts > Sent: 29 March 2010 6:04 > To: Flash Coders List > Subject: Re: [Flashcoders] What good is a Controller? > > > there is plenty of commentary out there to suggest that the > controller is > > largely unnecessary and that the views can do it all as encapsulated > objects > > (i've even read something by someone much smarter than me [ > > http://c2.com/cgi-bin/wiki?MvcIsNotObjectOriented] that suggested > that the c > > in mvc was anti-oop) but for me the benefit for the controller is > that i can > > create functionality separate from design. > > I don't think it's really "anti-OOP" as much as irrelevant to OOP. The > controller has nothing to do with your object domain model, it's just > a mechanism to get messages from views to models or other views, and > vice-versa. > > > if you look at the html / php / mysql model, mvc has a very natural > flow - > > the mysql database and the php interact much like the controller > (php) and > > the model (mysql) and the result is then fed to the views (the served > html > > page). > > Strictly speaking, that's not how most web application developers > categorize the components of an MVC design (despite what the Wikipedia > page says). PHP (or whatever application server you're using) would > serve both as the controller and the views, and perhaps even the model > as well. PHP itself doesn't really encourage this sort of separation > (although it doesn't prevent it either), but for example, in a Java > web app you might use JSP for your views, and a single servlet as a > controller, and beans as your model. And of course, JSPs, servlets and > beans are all just Java code. But, generally speaking, views are > responsible for their own rendering, which typically requires > server-side logic. If the view isn't responsible for its own rendering > (which would be the case in a static HTML view, then the design > pattern in question might better be described as Model-View-Presenter > (MVP): > > http://en.wikipedia.org/wiki/Model_View_Presenter > > Now, this doesn't take into consideration the use of client-side > functionality and where that fits, but that presumably would just be > additional view logic. > > Dave Watts, CTO, Fig Leaf Software > http://www.figleaf.com/ > http://training.figleaf.com/ > > Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on > GSA Schedule, and provides the highest caliber vendor-authorized > instruction at our training centers, online, or onsite. > _______________________________________________ > Flashcoders mailing list > [email protected] > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

