By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,051 Members | 1,198 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,051 IT Pros & Developers. It's quick & easy.

Classes in files

P: n/a
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{
}
Jan 29 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.
http://www.kratz.nl/
Jan 30 '07 #2

P: n/a
On Mon, 29 Jan 2007 23:52:49 -0800, Willem Bogaerts
<w.********@kratz.maardanzonderditstuk.nlwrote:
>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
Jan 30 '07 #3

P: n/a
Rik
Curtis <ze******@verizon.netwrote:
On Mon, 29 Jan 2007 23:52:49 -0800, Willem Bogaerts
<w.********@kratz.maardanzonderditstuk.nlwrote:
>>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:
http://nl2.php.net/manual/en/language.oop5.autoload.php
--
Rik Wasmus
Jan 30 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.