Thinking MVC

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

User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

McGruff wrote:But why do you want an MVC architecture in the first place?
I assume by it that you mean why have a View/Controller separation as opposed to a monolithic Presentation layer. I also assume that you are not suggesting that the separation between the Presentation layer and the Domain layer be violated.

Given that the current practice of MVC in PHP does not require strict adherence to any of the several variations of the MVC pattern, the question actually becomes:

Why not do View/Controller separation?
(#10850)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

superdezign wrote:
McGruff wrote:But why do you want an MVC architecture in the first place?
PHP in HTML... HTML in PHP... It was all too messy for me. I've had a basic MVC for about a month now, but the controllers were hardcoded as pages, and the modules and views were merged into one element. The separation to that much was much neater than previous but getting closer a pure MVC structure is proving to be even more manageable. It's just a matter of "doing it properly" at this point.
You can still achieve MVC using pages - ASP.NET uses pages. The only difference is it's more a page controller design than front controller design which is more common in PHP (what Java calls a Model 2 design).
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Hockey wrote:You can still achieve MVC using pages - ASP.NET uses pages. The only difference is it's more a page controller design than front controller design which is more common in PHP (what Java calls a Model 2 design).
I like the way the front controller makes it a bit more dynamic. Plus, It's a lot more comfortable to send mod_rewrite straight to my index and then allow me to process the requests myself. My remote server doesn't support PCRE in mod_rewrite, so I feel that PHP should be the one to take care of it.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

I think most PHP developers do. :)
Post Reply