Classes in files

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

    Classes in files

    I have the following class structure and I'm wonder how best to put this
    in seperate files/folders instead of all in one file. Thanks!

    class A{
    }
    class A1 extends A{
    }
    class A2 extends A{
    }
    class A3 extends A{
    }
    class A1a extends A1{
    }
    class A1b extends A1{
    }
    class A1c extends A1{
    }
    class A2a extends A2{
    }
  • Willem Bogaerts

    #2
    Re: Classes in files

    I have the following class structure and I'm wonder how best to put this
    >
    in seperate files/folders instead of all in one file. Thanks!
    It does not really matter if you put each class in its own file or if
    you group them in library files. It is just a matter of personal taste.

    What I really avoid is mixing "free running" code with class or function
    definitions. A file should either define something or run something. Not
    both.

    --
    Willem Bogaerts

    Application smith
    Kratz B.V.

    Comment

    • Curtis

      #3
      Re: Classes in files

      On Mon, 29 Jan 2007 23:52:49 -0800, Willem Bogaerts
      <w.bogaerts@kra tz.maardanzonde rditstuk.nlwrot e:
      >I have the following class structure and I'm wonder how best to put this
      >>
      >in seperate files/folders instead of all in one file. Thanks!
      >
      It does not really matter if you put each class in its own file or if
      you group them in library files. It is just a matter of personal taste.
      >
      What I really avoid is mixing "free running" code with class or function
      definitions. A file should either define something or run something. Not
      both.
      >
      That's a good point you make there.

      It might be fine to keep all the sub classes in one file, if they're small
      enough. Usually, it'd be better to minimize the amount of require and/or
      include constructs used.

      --
      Curtis

      Comment

      • Rik

        #4
        Re: Classes in files

        Curtis <zer0dyer@veriz on.netwrote:
        On Mon, 29 Jan 2007 23:52:49 -0800, Willem Bogaerts
        <w.bogaerts@kra tz.maardanzonde rditstuk.nlwrot e:
        >
        >>I have the following class structure and I'm wonder how best to put
        >>this
        >>>
        >>in seperate files/folders instead of all in one file. Thanks!
        >>
        >It does not really matter if you put each class in its own file or if
        >you group them in library files. It is just a matter of personal taste.
        >>
        >What I really avoid is mixing "free running" code with class or function
        >definitions. A file should either define something or run something. Not
        >both.
        >>
        >
        That's a good point you make there.
        >
        It might be fine to keep all the sub classes in one file, if they're
        small enough. Usually, it'd be better to minimize the amount of require
        and/or include constructs used.
        When on PHP5:

        --
        Rik Wasmus

        Comment

        Working...