Connecting Tech Pros Worldwide Forums | Help | Site Map

How far down can requests go?

bryan
Guest
 
Posts: n/a
#1: Jan 24 '06
lets say I have file, index.php that includes a file logic.class.php,
and inside of index.php i initialize the class, $logic = new logic;
now, lets say that the $logic object inside the class file uses ANOTHER
class, $template = new template; for templating it and lets say the
TEMPLATE object users ANOTHER class...my question is does it matter how
far down you go inside the files? will they all still work fine? Is
there a limit? Is this just bad design? Need some input.

thejadedmonkey@gmail.com
Guest
 
Posts: n/a
#2: Jan 25 '06

re: How far down can requests go?


>From what I know about PHP, there is no imposed limits that you need to
work around.

However, keep in mind that for each new file that PHP has to include
something from, it needs to load it into memory, execute it, and that
all takes time which will slow down the program.

Peter Fox
Guest
 
Posts: n/a
#3: Jan 25 '06

re: How far down can requests go?


Following on from bryan's message. . .[color=blue]
>lets say I have file, index.php that includes a file logic.class.php,
>and inside of index.php i initialize the class, $logic = new logic;
>now, lets say that the $logic object inside the class file uses ANOTHER
>class, $template = new template; for templating it and lets say the
>TEMPLATE object users ANOTHER class...my question is does it matter how
>far down you go inside the files? will they all still work fine? Is
>there a limit? Is this just bad design? Need some input.
>[/color]

I've got down to 9 deep and no problem.
Of course it isn't 'bad design' - but it might be!
Objects are /really handy/ but occasionally you can over do things.

--
PETER FOX Not the same since the porcelain business went down the pan
peterfox@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Chung Leong
Guest
 
Posts: n/a
#4: Jan 25 '06

re: How far down can requests go?



bryan wrote:[color=blue]
> lets say I have file, index.php that includes a file logic.class.php,
> and inside of index.php i initialize the class, $logic = new logic;
> now, lets say that the $logic object inside the class file uses ANOTHER
> class, $template = new template; for templating it and lets say the
> TEMPLATE object users ANOTHER class...my question is does it matter how
> far down you go inside the files? will they all still work fine? Is
> there a limit? Is this just bad design? Need some input.[/color]

In my opinion, there is no "good" and "bad" in programming. Just "what
works" and "what doesn't work."

IFAIK there is no limit to how many level of includes you have. It's a
matter of personal preference. Personally I perfer to include only at
the top level so that it's easier to see what files are involved in a
particular script.

bryan
Guest
 
Posts: n/a
#5: Jan 25 '06

re: How far down can requests go?


Okay because to be perfectly frank, this setup right now is extremely
simple to understand from a code stand point. if something happens bad
while doing x, edit x.class.php and it will be fixed, etc, or the
general constants file. It works great so far just wondering if this
would offer any 'problems' later on down the road with a lot of
traffic. Thanks for the replies guys.

d
Guest
 
Posts: n/a
#6: Jan 25 '06

re: How far down can requests go?


"Chung Leong" <chernyshevsky@hotmail.com> wrote in message
news:1138151910.889433.106930@g43g2000cwa.googlegr oups.com...[color=blue]
>
> bryan wrote:[color=green]
>> lets say I have file, index.php that includes a file logic.class.php,
>> and inside of index.php i initialize the class, $logic = new logic;
>> now, lets say that the $logic object inside the class file uses ANOTHER
>> class, $template = new template; for templating it and lets say the
>> TEMPLATE object users ANOTHER class...my question is does it matter how
>> far down you go inside the files? will they all still work fine? Is
>> there a limit? Is this just bad design? Need some input.[/color]
>
> In my opinion, there is no "good" and "bad" in programming. Just "what
> works" and "what doesn't work."[/color]

But how good code is determines whether "what works" becomes "what doesn't
work" due to unforseen circumstances ;) I've seen some incredible spaghetti
code, which does work, but is a nightmare to maintain. That is not "good",
as when it breaks, it would take ages to even find the problem, let alone
fix it. :)
[color=blue]
> IFAIK there is no limit to how many level of includes you have. It's a
> matter of personal preference. Personally I perfer to include only at
> the top level so that it's easier to see what files are involved in a
> particular script.[/color]

Very sensible.


bryan
Guest
 
Posts: n/a
#7: Jan 25 '06

re: How far down can requests go?


I agree. Yes and maintainability and scalability which I guess tend to
seemlessly go hand in hand are my top priorities usually when I work on
a project.

Closed Thread