patrick24601 Posted April 3, 2008 Share Posted April 3, 2008 I'd appreciate the community's opinion on this. Here is a purist OOP application design I am considering. I am curious as to how much this is going to affect performance with the multiple classes I am using. FYI... I am using PHP5, MySQL5, PEAR and Smarty. 1. Every call/postback to my website is going to go through index.php?function=xxxx 2. In index.php I instantiate a 'driver' class I have 3. That driver class/file is going to include_once() all of my business tier files/classes. It will call the business tier, get the data back, and then display the smarty page. 4. All of the business tier .php files are going to include their own data tier files/classes. 5. The data tier is the *only* place you will find SQL. It will build the queries, call PEAR, and return the data to the business tier. Thought 1 : I am thinking that I can save on performance by getting rid of what I am calling a 'data tier'. PEAR is really my data tier. So in my business classes I will have my SQL coded and just have the business class call PEAR to execute the query. Thought 2 : I can also go ulti-purist, get rid of my data tier, and put all of my sql into stored procedures. Your thoughts ? Thanks in advance, Patrick Quote Link to comment Share on other sites More sharing options...
trq Posted April 3, 2008 Share Posted April 3, 2008 Sounds pretty much how a typical MVC might operate. I wouldn't go including everything on every call though, use __autoload to only include what you need as you need it. Quote Link to comment Share on other sites More sharing options...
patrick24601 Posted April 3, 2008 Author Share Posted April 3, 2008 Just like it shows? Hot damn that is cool function! <?php function __autoload($class_name) { require_once $class_name . '.php'; } $obj = new MyClass1(); $obj2 = new MyClass2(); ?> Quote Link to comment Share on other sites More sharing options...
keeB Posted April 4, 2008 Share Posted April 4, 2008 The JAVA programmer in me is used to a header full on require_once() calls. I really prefer using it that way. If I ever write a basic testcase at the bottom of the file then I don't have to worry about dependencies in other 'packages' (again, the java thing.) Here's what the structure of my app looks like, Patrick: http://nick.stinemates.org/work-desktop.png . Ignore the python on the right :X Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.