rolo wrote:
> Do you not think that one class per file has lot of advantage is
> distribution of classes to be used by other programmers.

I think that a general rule for either method is bad. You have to evaluate
it on a case-by-case basis. My general method is do the one class per file
method, but if a class is completely dependent on another class and does not
make sense to be used in the context of a third class then you should put
them in the same file. A good example of this would be domain specific
exception classes but any kind of helper class would fall in this category
as well.

You probably don't want to have too many classes per file since that can be
confusing to maintain, but I don't see anything wrong with have a main class
or two and several helper classes all located in the same file. It groups
logically related items together. If you have too many logically related
items then split them out into a few files and put them all in the same
directory.

If you go strictly by the one class per file you can end up with hundred of
files and tens of "require" statements on every file to use externally
defined classes. This is bad for maintenance. On the other hand putting a
entire library or program in one file will also make maintenance hard
(unless the library or program is small).

That is just my two cents.

--
Eric Anderson