API Thoughts?
| From: | Sterling Hughes | Date: | Sun, 26 Aug 2001 23:29:59 +0000 |
| Subject: | API Thoughts? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-64366@lists.php.net to get a copy of this message | ||
Hey,
Currently working on the Binary Tree implementations for the ADT
extension and was wondering what people thought as more intuitive,
something like:
$tree = tree_new(AVL_TREE);
tree_insert($tree, $element, "compare_func");
// ...
Or:
$tree = avl_tree_new();
avl_tree_insert($tree, $element, "compare_func");
Basically the difference between a generalized tree api, where you
pass a constant to the constructor (if you allow me to use that term
:), or where every form of the tree has a different set of functions
(currently planned are Red-black tree's, AVL tree's, Simple Binary
Search Tree's and Btree's).
Thoughts? I'm currently leaning towards the first one...
-Sterling