How far down can requests go?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bryan

    #1

    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.

  • thejadedmonkey@gmail.com

    #2
    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.

    Comment

    • Peter Fox

      #3
      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@eminen t.demon.co.uk.n ot.this.bit.no. html
      2 Tees Close, Witham, Essex.
      Gravity beer in Essex <http://www.eminent.dem on.co.uk>

      Comment

      • Chung Leong

        #4
        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.

        Comment

        • bryan

          #5
          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.

          Comment

          • d

            #6
            Re: How far down can requests go?

            "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message
            news:1138151910 .889433.106930@ g43g2000cwa.goo glegroups.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.


            Comment

            • bryan

              #7
              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.

              Comment

              Working...