Re: [PEPr] Comment on Util::Util_Observable
| From: | Alan Knowles | Date: | Sat, 24 Jul 2004 01:29:44 +0000 |
| Subject: | Re: [PEPr] Comment on Util::Util_Observable | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-32294@lists.php.net to get a copy of this message | ||
PEPr wrote:
Heino H. Gehlsen (http://pear.php.net/user/heino) has commented on the proposal for Util::Util_Observable. Comment: Alan, although it’s correct that the double underscores are not common use in PEAR, they serve a distinct purpose, since they are used to differentiate between primary and secondary classes in the same file. Not in pear, and have never done so, they primarily indicate a heirachy which has a distict and strong relationship to file location - this for me is one of the most important features of PEAR, I'm never left in the situation, that I have to go hunting around to find the source to any Class. As apposed to C, Java and C# where I either have to grep entire source trees or google for the definition (this wastes alot of my time, and is something that infuriates me no end..).
This prevents future conflicts since such secondary classes don’t break the classic naming. Take the DB.php file in PEAR for instance; it includes multiple classes too: DB, DB_Error, DB_result etc. Such class names would conflict with a possible future file named DB/Error.php, which would have precedence according to the naming convention. Like it or not, but that’s my reasoning for using double underscores.. Just because you "can" add a rocket to a car doesnt mean that everybody is going to blow them selves up.. - this is a very loose argument.
As for you complaint about the WTF is the source, I believe the above explanation should be enough to prove that the "WTF is the source for this" syndrome has been taken care of.No it doesnt help at all - you are still left with the situation, I'm reading Mail/smtp.php, and it has a method function observer(Util__iObservable $xxxx) { ..... Where am I supposed to find that interface - to check it matches what I want to send it? - I'm going fishing again: Whereas : function observer(Util_Observable_Interface $xxxx) { ..... I know exactly where I will find it:
Also the above explanation should explain why I personally don’t like your “Util_Observer_Interface_* all stored in Util/Observer/Interface.php” suggestion. Why? - the "because it involves typing too much" seems the only viable justification for your logic, and that doesnt hold much water when you are delivering code that has to be re-used by others.Regards Alan
Proposal information: http://pear.php.net/pepr/pepr-proposal-show.php?id=125