473,395 Members | 1,383 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,395 software developers and data experts.

OO wonders

hi

I'm using the model view controller to develop an application

each class of the controller package (FileController, ArticleController)
has the main controller (Controller) as a member.

The controller has the DbAccess object as a member

which means that when I need to call the a method of the DbAccess from a
controller class, it looks like that :

$this->oController->oDbAccess->fetchArray(...) for example.

Now my question is, is that a problem for the performance of the
application. Should I declare the Controller and the DbAccess as GLOBAL
variables or doesn't it matter ? I prefer to avoid using GLOBAL, I think
it's ugly, but would be happy to use it if it's good for the speed of
the code.

Since php is not fully object oriented, I'm sometimes wondering if
designing it Java or Python style is not a bad idea.

Any comment appreciated !

thanks

.b
Jul 17 '05 #1
1 1511
Hi odel!

On Tue, 21 Oct 2003 13:05:03 +0100, odel <b@twin-pix.com> wrote:
hi

I'm using the model view controller to develop an application

each class of the controller package (FileController, ArticleController)
has the main controller (Controller) as a member.

The controller has the DbAccess object as a member

which means that when I need to call the a method of the DbAccess from a
controller class, it looks like that :

$this->oController->oDbAccess->fetchArray(...) for example.

Now my question is, is that a problem for the performance of the
application. Should I declare the Controller and the DbAccess as GLOBAL
variables or doesn't it matter ? I prefer to avoid using GLOBAL, I think
it's ugly, but would be happy to use it if it's good for the speed of
the code.


You can use a singleton object instead of a global.

something like:

class mediator {

function &project_instance(){

static $instance;

if (!isset($instance)){
$instance = new project();
}

return $instance;
}
}

$x =& mediator::project_instance();

This will give you always the same object, without using global.

HTH, Jochen
--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 17 '05 #2

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

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
0
by: Cliff Wells | last post by:
QOTW: "I find it hard to believe nobody has tried this yet, unless it's the case that those who know how to do it also know that it's actually not possible for some reason..." -- Peter Hansen...
39
by: scooter | last post by:
Given this class heirarchy class Base{}; class A : public Base {}; class B : public Base {};
6
by: ALthePal | last post by:
Hi, I'm not sure if we are able to or even how to loop through the web forms in a VB.NET project during design time. In MSAccess we are able to go through the database -> forms collection and...
19
by: Cool Guy | last post by:
How can I centralize all page elements with CSS? Like the equivalent of wrapping the body in <center>..</center>?
9
by: Edward | last post by:
Hello I hope someone could help me I'm trying to prevent code from running before the thread I created completes. Here's the code snippet DataTransformerWorker dtw = new...
3
by: Bredal Jensen | last post by:
Hello, I have an asp.net web app hosted on a win2k3 server . The web app consumes a web service also hosted on the server. They both have acces to an sql server 2000 database also on the same...
1
by: xFiver | last post by:
Hey gang, I'm having a tough time wrapping my head around this problem. More than anything, I'm looking for the "why" of why this isn't working. THE SETUP: I have a Cross-Tab query (we'll...
1
by: snowsgood | last post by:
This is an interuption of your regularly scheduled Computer talk......Please stand by for something else that is cognitive.... God bless those that care...even if they don't care about me. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
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.