Re: API Thoughts?

From: Date: Mon, 27 Aug 2001 14:30:42 +0000
Subject: Re: API Thoughts?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-64404@lists.php.net to get a copy of this message
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 <sterling@designmultimedia.com>: > 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, <chuck@horde.org> Some fallen angels have their good reasons.

« previous php.dev (#64404) next »