[wp-hackers] PHPMailer was a mistake

Tom Barta tbarta at gmail.com
Sun Sep 16 07:29:01 GMT 2007


> Classes should be separated, unlike the mess that is WordPress classes.
> You should be able to look at the class path and be able to find the
> class. This is what I've been saying! If you *NEED* documentation to
> find a class, then you are doing something wrong. The benefits of
> splitting the classes into their separate files, is more than this
> however. It is good coding practice, because it makes it easier for
> other developers, for the above and is the defined coding style of other
> languages. If you don't agree with me, you *SHOULD* agree with
> programmers far smarter than you and I would ever hope to even dream to be.

I know PEAR perfers 1 class per file, but there are definitely
performance reasons for avoiding it.  Loading 100 classes in 100 files
may (even with APC-style script caching) be substantially slower than
loading 100 classes in 10-20 files.  Even with C++, large-scale
software often has multiple classes per file in order to reduce
compile times.  Just because Java has dictated "1 public class per
file" doesn't mean it's always the right answer, for every other
programming language.

Finding a class is just a grep away, no matter how large or
poorly-organized a codebase is.  If you *NEED* documentation to find a
class definition in an arbitrary directory, you will probably have
problems on any large project (I suppose if you don't have grep
available, that could be a problem; but that's your toolchain that's
the problem, not the codebase itself).


More information about the wp-hackers mailing list