Because of Drupal's flat namespace for hook functions, there's a potential for conflict between UC hooks and hooks from other contributed modules. Although I have seen no Drupal coding standards that explicitly address this, I think it would be a very, very good idea to avoid problems by including _uc_ in all the Ubercart hook names.
Prefixing the hook name with the module name like this seems to be the de facto standandard way of doing things in Drupal contributed modules (see Views, for example).
In the case of Ubercart, this would mean hook_order() becomes hook_uc_order(), etc. I don't think it's necessary to further subdivide the namespace using the actual UC module name - a simple _uc_ to designate it as part of Ubercart should be sufficient to fend off namespace collisions. (Besides, using the module name instead of just _uc_ would lead to silly things like hook_uc_order_order()).
Yeah, it would require changes in a lot of code, but they're simple changes. I see it as something that's going to have to be done eventually, so it may as well be done now while a change like this is still manageable.



Re: Namespace for Ubercart hooks
Hmm... while I agree with you in principle (for example, we do this in as many variables as we can remember to do it), I'm not sure if it's really necessary for hooks. I'm not saying something won't come up, but I just don't know what other module package you'd install that would cause a conflict with Ubercart's core hooks. In the only case it might happen, we don't want folks to have Ubercart and e-commerce installed on the same site anyways since it would break plenty of other things, too. At the moment, I'm inclined to leave it as is and trust that we're big enough that other modules wanting to work in conjunction with Ubercart would be developed around our hook system. At the very least, I wouldn't consider making a change until the next major version of Ubercart.
Thoughts?
Re: Re: Namespace for Ubercart hooks
I agree with Ryan. Of the Übercart hooks that I can think of, their function is already apparent in their name. hook_product_info(), hook_cart_pane(), hook_shipping_method(). Any module that had functions named like that are probably used for e-commerce (the activity, not necessarily the modules), and are either made for Übercart or shouldn't be used with Übercart. Perhaps I'm overestimating our fame, but I think by this point that anyone writing a Drupal module like that knows about us and would tell others that we are probably incompatible.
Re: Re: Namespace for Ubercart hooks
I certainly don't think it is a bad idea to standardize the hook names. I can see something like hook_order causing problems in the future. I agree with Ryan and Lyle that many of these hooks are e-commerce specific in a way that shouldn't conflict with other modules, but something like hook_order could be used in the context of many different modules. Assuming these other modules follow what I've noticed as somewhat of a standard and implement hook_modulename_order(), then there won't be a conflict. If they decide that they also are popular/large/exclusive enough to simply use hook_order though, then there is a problem.
So I'm in favor of appending uc_ to Ubercart core hooks, agreeing with TR that it will need done eventually...so it might as well be done sooner rather than later.
Re: Namespace for Ubercart hooks
Any consideration for this in d6 development? It would be nice to see.