On Tue, 14 Jun 2005, Wiggins d'Anconia wrote: > The difficulty in developing in an MVC way is often sighted as a > reason not to use PHP/ASP (even Mason) in web development
Oh? That isn't how I read things. The problem with PHP / ASP / JSP / Mason isn't that these frameworks make use of an MVC design. MVC is no big deal, it shows up all the time as, for example, every CGI script [controller] that stores data on the server [model] and presents an interface to it over the web [view]. This division of labor can broadly be used to describe more or less every web site ever: Amazon, eBay, CNN.com, the iTunes Music Store, etc. Still more broadly, the vast majority of work that most programmers do in the real world is just glorified MVC -- whether it's web programming, using Visual Basic or similar tools to put a graphical interface in front of an Access database, or even a lot of server programming, where you have some kind of data store you're serving [model], some kind of protocol for sharing that data [view], and code for making it work [controller]; cf. Apache, mail servers, etc. That's the whole appeal of giving this wide class of problems a common name and a common description. They all seem superficially different, but once you recognize the similarities, you can start getting in the habit of re-using the same techniques for solving these problems. Just to give an example, a CGI/DBI script really isn't so different from a VB/Access application, and with some cleverness & forethought, you might even be able to merge things so that the same framework can provide both a web and a desktop interface. Part of the trick in getting in the habit of reusing the MVC pattern is recognizing that it works best when the three components -- again, a data model, some kind of interface view, and controlling middleware -- are isolated from one another. If you do that, then you can swap out part of the system without disrupting things -- by, say, changing database servers, or providing web & desktop interfaces, etc. And *that* is the big problem with tools like PHP, ASP, JSP, and Mason: all four of these co-mingle the View and the Controller, so that later on if you want to make changes to the view or to the controller, you run the risk of disrupting & introducing bugs to both of them. If they were mutually isolated, the way Template Toolkit and HTML::Template do, then changes to your interface shouldn't break your code, and changes to your code shouldn't harm your interface. By having them separate, the system becomes much easier to maintain in the long run. But there's no problem with MVC itself. Indeed, as I say, unless you're working on specialized [academic] systems, most of your professional life as a [commercial] programmer is likely to be spent working on things that are just MVC by another name, so you might as well learn how to be efficient at developing such systems. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>