Do you use the MVC pattern in you applications or not?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Do you use the MVC pattern in you applications or not?

Poll ended at Sat Apr 14, 2007 2:47 am

Yes, I do.
14
82%
No, I don't.
3
18%
 
Total votes: 17

User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Do you use the MVC pattern in you applications or not?

Post by Oren »

So... do you?
Zu
Forum Commoner
Posts: 33
Joined: Wed Dec 06, 2006 4:21 am

Post by Zu »

If the project requires a MVC, then yes. Often a project doesn't require that level of complexity.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

I do providing it isn't overkill. It should almost be called Emulated Model View Controller though, as PHP by nature doesn't support true MVC.

I would probably call it something more along the lines of Controller, Executioner, Renderer. CER. That would make more sense.

But thats just me. :wink:
webaddict
Forum Commoner
Posts: 60
Joined: Wed Mar 14, 2007 6:55 am
Location: The Netherlands

Post by webaddict »

Zu wrote:If the project requires a MVC, then yes. Often a project doesn't require that level of complexity.
True enough, but I like the way it works. There aren't a lot of projects that I would do without using some kind of a framework (be it Zend, Code Igniter or my own). Aforementioned frameworks don't force you, but they do guide you into the principle of Model View Controller.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

All the time. I beg to differ that it's "complex" once you get used to it. Granted, it took me a long time to really fathom out what goes where, but now I wouldn't find code anywhere near as maintainable without it.
User avatar
Buddha443556
Forum Regular
Posts: 873
Joined: Fri Mar 19, 2004 1:51 pm

Post by Buddha443556 »

I do my best to separate the presentation from the model. Any use of MVC pattern on my part is probably accidental because I don't spend much time worrying about patterns.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Buddha443556 wrote:I do my best to separate the presentation from the model. Any use of MVC pattern on my part is probably accidental because I don't spend much time worrying about patterns.
I'm the same.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

provided it makes sense to do so
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

feyd wrote:
Buddha443556 wrote:I do my best to separate the presentation from the model. Any use of MVC pattern on my part is probably accidental because I don't spend much time worrying about patterns.
I'm the same.
The Model/Presentation separation is probably 80% of MVC. There is no hard and fast rule as to where the dividing line is between the Controller and View, or even what the dependencies must be. So if you write modular code with clear/clean dependencies, the you are both using MVC -- whether you like it or not. ;)
(#10850)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Buddha443556 wrote:I do my best to separate the presentation from the model. Any use of MVC pattern on my part is probably accidental because I don't spend much time worrying about patterns.
I am along those sames lines... somewhat. My current app I am building for work uses a controller that serves everything through index.php based on page name, that then gets thrust through the page rendering class which implements any modules for that page name, parses that pages template and outputs a page.

If I said it was MVC it would probably make the die hard MVC coders puke, so I staying away from that classification. It is similar, but I would not say I use MVC.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

So we have a poll about a little understood pattern that most people are not sure if they use or not... ;)
(#10850)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

In the words of a personal PHPDN acquaintance:
I dunno
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

arborint wrote:So we have a poll about a little understood pattern that most people are not sure if they use or not... ;)
That's MVC for ya! I've seen more MVC topics than any other design pattern in my time.

It's always "controller" that gets confuddled with the layers either side of it. Controller is fairly minimal simply passing notes between the other two layers.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

d11wtq wrote:Controller is fairly minimal simply passing notes between the other two layers.
Yes, that's how I see it.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

I think maybe a confusing thing about the Controller is that it is sort-of defined by not being the View. I mean that in the sense that the Controller is the non-output code in the presentation layer. The Controller is about program flow. For example, you may have two views of the same data: tabular HTML and an XML data feed. The program flow is essentially the same, and the Model is obviously the same.

This gets to the essence of separations --- they are about defining modules, especially for reuse. Views are modular outputters. Models are modular data sources. Controllers are modular request managers. And those are the essential modules of an application.
(#10850)
Post Reply