I've always wondered this about OOP and maybe you guys can answer this question.
I'm writing a php application and I'm trying to figure out the correct way to right the oop part of this application.
for instance.
I have a "project.class" file that has functions for dealing with individual projects because you break down ideas into singular entities in OOP(as I understand it)
But what if I wanted to deal with multiple projects such as getting a list of the projects in my database, should I create a function in the "project.class" to handle the now plural request, or should I create a "projects.class" file that has a function called "getProjects".
Hopefully I'm explaining this question right. It makes sense in my own head. :-)
If I get what you're doing right, then you need to break it down more, if you wanna go truly OOP ... and create an array of objects.
Something like:
$arrProjects[] = new project($projectname);
and then have an object for each idea, that are handled by the projects, like:
class Project { var $project_name; var $arrIdeas[];
function Project($projectname) { $this->project_name = $projectname; }
function add_idea() { $this->arrIdeas[] = new idea(); } }
Just remember that PHP isn't a true OOP language, so going OOP may not necessarily be the best solution always. OOP makes certain types of projects easier to code, and some projects would be almost impossible to do without OOP (like anything you wanna do where you need to use scope to avoid major headaches), but because PHP isn't compiled or a true OOP language, OOP in PHP hampers performance, and that hampering is exponential with the complexity of the objects.
FWIW
Rene
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php