You are here: Re: MVC/OO pattern clarification « PHP Programming Language « IT news, forums, messages
Re: MVC/OO pattern clarification

Posted by jmark on 05/21/07 17:00

On May 18, 8:54 am, "rickycorn...@gmail.com" <rickycorn...@gmail.com>
wrote:
> Greetings All,
>
> I had a question about OO implementation in theMVCpattern that is
> directed at anyone who feels experienced with it.
>
> My fuzziness comes from trying to learn OOP andMVCat the same time,
> coming from a procedural background where I used neither. I promise
> I'm not a dummy, and my logic skills are very strong, but this really
> is a whole new world for me.
>
> >From my study ofMVCthe role of the controller component is most
>
> confusing to me. Traditionally, it seems that the controller was used
> in os-based software to manage input from the user, the actual data
> type handling, etc, where on a statically typed language or os-based
> software that is more of an issue. Reading a Developer's Library book
> called "Advanced PHP Programming" by a guy named George Schlossnagle
> (who seems like a fairly bright programmer) the assertion is made that
> the controller is irrelevant to the web because the browser handles
> all the input. Obviously that's not the stance of a big part of the
> community, as frameworks like Symfony, etc make a big deal out of the
> controller. The PHP-framework implementation of a controller seems to
> be more abstract than in os-software.
>
> So my question is, if I were to implement a controller, what I gather
> is basically that the model component would be comprised of only
> classes with no procedural execution, and that the controller would
> primarily be responsible for all instantiation of the model's business-
> logic classes? Is that the idea? I realize Imaybe asking for an
> answer that involves personal preference but if you have one, please
> let me know. Thank you in advance!
>
> Ricky

The work of the controller is to perform basically the common routines
that would otherwise have been done individually in each class. This
includes authentication, input validation and sanitization, processing
requests, and displaying messages.
The controller can be single file like index.php (just an entry
point). This can be either procedural or OOP. There is no much
advantage of using OOP here. Or it can be implemented as part or
component of the superclass.
The drawback to having it in a file like index.php is that you have to
include the class file in the url and also it may not be search engine
friendly. But its advantage is that objects are instantiated in one
file while if you had the controller int he superclass you have to
instatiate each object in its own class.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация