Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: The Model View Controller pattern in web applications

by pg (Canon)
on Oct 24, 2004 at 21:51 UTC ( #402082=note: print w/ replies, xml ) Need Help??


in reply to The Model View Controller pattern in web applications

"MVC is an object-oriented design pattern"

This is a good introduction, but I definitely disagree with this assertion. MVC is a popular design pattern for web applications, those components, whatever M or V or C, can be realized in an OO way, or a non-OO way, that's simply irrelevant, although it is very normal for one to implement MVC in a OO way nowadays.

Design pattern is higher in level of abstraction than things like OO.


Comment on Re: The Model View Controller pattern in web applications
Re^2: The Model View Controller pattern in web applications
by Joost (Canon) on Oct 24, 2004 at 21:57 UTC
    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"?

      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!

        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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://402082]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (13)
As of 2014-09-02 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (25 votes), past polls