|Converting a site to OO php|
| 2:29 am on Sep 29, 2002 (gmt 0)|
Ok, so I've got a community site that I wrote from scratch starting this past Spring, using PHP and PostgreSQL. It works pretty well, and I even have a group of people who use it in preference to a Yahoo! group. I'm still working on the code, though, and I'm thinking about re-working it using classes and inheritance.
The design is one that would convert to an OO paradigm very easily, even though I haven't used explicit OO features of PHP so far. What worries me is performance issues. The page consists of a framework that makes a DB connection, authenticates users, displays a header, footer, and navbar, and calls one of its components to fill in the 'main' content area. The navbar can be added to by each component by defining a function of a certain name in a particular file within the component's directory hierarchy. These are pretty light-weight functions, and therefore should take little time to parse and execute. This is good, because it means that for any given page view, I only load an execute the bulk of a component's code if it's actually being used. If I make the components into objects, and the navbar function into a method, is there any way to keep from loading the entire bulk of every component on every page view?
| 6:53 am on Sep 29, 2002 (gmt 0)|
I don't understand, if it works well as is and you are concerned that with the change it may increase load times why change?
| 7:11 am on Sep 29, 2002 (gmt 0)|
Because about half the reason for writing all this is as an excercise in expanding my PHP skills :)