473,396 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

MVC/OO pattern clarification

Greetings All,

I had a question about OO implementation in the MVC pattern that is
directed at anyone who feels experienced with it.

My fuzziness comes from trying to learn OOP and MVC at 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 of MVC the 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 I may be asking for an
answer that involves personal preference but if you have one, please
let me know. Thank you in advance!

Ricky

May 18 '07 #1
1 1554
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.
May 21 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Han | last post by:
Determining the pattern below has got my stumped. I have a page of HTML and need to find all occurrences of the following pattern: score=9999999999&amp; The number shown can be 5-10 characters...
8
by: gsv2com | last post by:
One of my weaknesses has always been pattern matching. Something I definitely need to study up on and maybe you guys can give me a pointer here. I'm looking to remove all of this code and just...
4
by: Xah Lee | last post by:
20050207 text pattern matching # -*- coding: utf-8 -*- # Python # suppose you want to replace all strings of the form # <img src="some.gif" width="30" height="20"> # to # <img...
15
by: Mountain Bikn' Guy | last post by:
Is the second version shown below better? I couldn't locate enough info about in order to tell. 1.. My commonly used singleton pattern implementation looks like this (it was inspired by Eric...
8
by: Sai Kit Tong | last post by:
In the article, the description for "Modiy DLL That Contains Consumers That Use Managed Code and DLL Exports or Managed Entry Points" suggests the creation of the class ManagedWrapper. If I...
5
by: Diffident | last post by:
Hello All, I am designing a class based on singleton pattern. Inside this class I have multiple instance methods. My question is since there will be only one instance of this class at any...
34
by: Steven Nagy | last post by:
So I was needing some extra power from my enums and implemented the typesafe enum pattern. And it got me to thinking... why should I EVER use standard enums? There's now a nice little code...
13
by: Dog Ears | last post by:
I've got a windows form that monitors the status of employees it polls a database every 2 seconds to fetch updates then update a underlying dataset bound to a grid using Invoke to marshal to the...
4
by: C# | last post by:
http://www.questpond.com/FreeDesign1.htm I was going through the above videos. Can i conclude Abstract factory patterns are extensions of factory patterns. I have made the conclusion after...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.