Re: Re: DB Exceptions - Sample Code
| From: | Alan Knowles | Date: | Sat, 10 Jul 2004 00:59:10 +0000 |
| Subject: | Re: Re: DB Exceptions - Sample Code | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-31816@lists.php.net to get a copy of this message | ||
The one class per file rule very usefull, however there are always going to be situations where it is not perfect, and putting a bunch of classes (or adding a small unused one) to a larger file make sense..
The aim of the one class per file is to make it easy to locate the source of a object/class.
with PEAR_IOException or DB_ExplodedException,it would be difficult to locate the code (if necessary)
with PEAR_Exception_IO or DB_Exception_Exploded,it is likely the files are in PEAR/Exception.php and DB/Exception.php
Speedwise, at present, I doubt there is any difference in preformance between defining a number of classes as opposed to the same number of defines. (it may be marginally slower if someone has fixed the define slowness). But Used well, it's probably going to be a huge improvement.Of course this also implies that will be getting rid of the one class per file rule for exceptions, reading a couple hundred little files would be really slow. -josh