473,404 Members | 2,213 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,404 software developers and data experts.

How far down can requests go?

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.

Jan 24 '06 #1
6 1067
>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.

Jan 25 '06 #2
Following on from bryan's message. . .
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.


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
pe******@eminent.demon.co.uk.not.this.bit.no.html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.demon.co.uk>
Jan 25 '06 #3

bryan wrote:
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.


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.

Jan 25 '06 #4
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.

Jan 25 '06 #5
d
"Chung Leong" <ch***********@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...

bryan wrote:
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.
In my opinion, there is no "good" and "bad" in programming. Just "what
works" and "what doesn't work."


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. :)
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.


Very sensible.
Jan 25 '06 #6
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.

Jan 25 '06 #7

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

Similar topics

11
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
24
by: Nancy Drew | last post by:
hi all i'm trying to keep users from being able to login to a site twice at the same time. everytime a user does a login, i stick their userID into an application scoped array. if they try to...
1
by: Vic Spainhower | last post by:
I have 2 drop-down menus (1) States (2) Shows By State. My question is how do I invoke a re-build of the Shows By State drop-down when the user requests a different state. I believe this has to be...
1
by: Vic Spainhower | last post by:
I have 2 drop-down menus (1) States (2) Shows By State. My question is how do I invoke a re-build of the Shows By State drop-down when the user requests a different state. I believe this has to be...
3
by: Reb | last post by:
Hi, I am using drop down menu in my pages. In one of my page,there is a listbox control below the menu. This listbox control is hiding the drop down menu items. How can i make the drop down...
3
by: Reza Solouki | last post by:
Hello, I ran the Microsoft Baseline Security analyzer 1.2 on my developement machine, then as one of the requests. Also updated the machine 1.1 Framework with service pack 1. Now everytime I...
8
by: Jim Toth | last post by:
I have a multithreaded application that is posting XML requests to a remote web site. As more and more calls are made to HttpWebRequest.GetRequestStream, the length of time increases for each call...
3
by: Tony | last post by:
I've done a fair bit of searching on this, but I want to be certain about what I've found - so here goes with a long example and three questions: For clarity, let me give an example (a number of...
4
by: rzimerman | last post by:
I'm hoping to write a program that will read any number of urls from stdin (1 per line), download them, and process them. So far my script (below) works well for small numbers of urls. However, it...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.