Alright. I think I've stated this before, but, just so everyone knows: I'm
gonna kick and scream whenever I think something is being done for expediency
and it's the wrong thing to do from a design/engineering perspective. You're
probably all gonna hate me, but someone has to do it.
Quoting Sterling Hughes <[EMAIL PROTECTED]>:
> The above are imho pretty ugly, and this is meant as more of a language
> level feature, I'm thinking of using PEAR as more of a method of
> distribution than a mindset.
They are only ugly because we don't have namespaces in PHP. If we had
namespaces, then your code example (which I'll comment on below) would be fine.
But as is, the way you are organizing the code causes namespace pollution. This
isn't something that we can stop end-user developers from doing, but if we
don't strictly adhere to namespace standards in the code in PEAR, _no one_ will
do it, and we will have a mess on our hands.
Some standards are only worth having if you enforce them. I think class naming
is one of them.
> The current way I have it organized is as follows:
>
> php4/pear/ADT.php
> php4/pear/ADT/LList.php
> php4/pear/ADT/Stack.php
> php4/pear/ADT/Queue.php
> php4/pear/ADT/AVLtree.php
> php4/pear/ADT/BTree.php
> php4/pear/ADT/RBTree.php
> php4/pear/ADT/Heap.php
> php4/pear/ADT/Set.php
If you want the tree classes to share the same API - or even a subset of it,
they _really_ should be subclasses of an ADT_Tree class.
> then you could do something like:
>
> <?php
> require_once('ADT/Queue.php');
>
> $sounds = new Queue;
[snip]
If you make that $sounds = new ADT_Queue(); ... then I'm happy.
(pet peeve: require_once and friends are statements. You don't need the
parentheses.)
-chuck
--
Charles Hagenbuch, <[EMAIL PROTECTED]>
Some fallen angels have their good reasons.
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]