Well, depending on the exact definition of the pattern (and there is a certain amount of confusion about it), there are arguments for and against.
I do agree that the MVC structure as presented here is not necessarily object-oriented. Maybe I should have said "MVC was invented as an object-oriented design pattern"?
| [reply] |
The same simple idea is behind all those concepts: to modulize things. Start from wrapping code in functions, to OO, to MVC, this is all about modulization.
When the web application is no longer just a bunch of static pages, or something relatively static like shipping cart or a forum like this, it becomes too complex for things like CGI etc. Once again, people need to simplify what they are dealing with and the way they looking at the applicatin. MVC comes in.
Model can be simply understood as the data (could be database, a flat file, a set of XML's), or activities against the data (for example a query, or an upadte, an OO method against a dataset object, a SOAP call, a Java Enterprise Bean...)
View is the window for you to see the data and its transition.
You need something to glue your model and view together, or I would rather say to seperate them, but yet attached. Now here comes the controller. As you said, for a web application, this is where your requests got handled.
There are lots of challenges when you do web application in MVC way. My experience tells me that one of the biggest challenge is the cost. If you want to do everything right (everything MVC), with the tools you have now, the effort is hugh. No free lunch!
| [reply] |
I agree on most of your points, and I know from experience that MVC can be a huge and costly effort. :-/
I do think that for smaller CGI applications it can still be beneficial to try and separate the three components, because in my experience, those are just the kind of apps that get coded before they're designed.
If you take something like CGI::Application, I think it will make a big difference already for those apps. Even if you don't do the full MVC separation.
Bigger and more complicated applications tend to get more design time anyway (ignoring an abundance of contrary examples), and are _hopefully_ more maintainable just because of that.
| [reply] |