[development] Don't push the API name considerations off as less important than performance

Scott McLewin drupal at mclewin.com
Tue Sep 26 15:46:26 UTC 2006


Moshe Weitzman wrote:
> this thread started with 2 successive messages filled with juicy 
> technical details aimed at speeding up core drupal. it makes zero 
> sense to talk about variable names at this stage.
Then I'll branch the thread so it will make sense.

As a module maintainer and former clueless noob on Drupal I believe that 
the variable and hook names used are important to facilitating developer 
adoption.  I am coming up on two years of working within Drupal and I 
still keep discovering new hooks, nooks and crannies where the interface 
names didn't indicate what I would use the hook for.  One could argue 
that this is because I'm slow or don't "get it".  I won't, but it is 
entirely possible.  :)  I'll argue that it shows the richness of 
Drupal.  I am repeatedly impressed.

Core performance is important.  Please don't forget that many of the 
fantastic improvements you all are working on are used in the context of 
sites with non-core modules, and it takes time on our part (the somewhat 
involved module maintainer crowd) to rework our modules to match the 
latest and greatest APIs.  I subscribe to this development list because 
I've found it is the most effective way to understand the changes that 
are pending.  5.0 adoption will be slowed while modules are ported to 
it.  Making that easier is important. 

If I saw something called "hook_signal()" when browsing the hook summary 
portion of the API I would not see immediate relevance to me - I don't 
think it communicates the intended meaning.  My *nix C background would 
have me wondering why a php script needed a signal handler.

In stylistic terms I too prefer hook_whatever_function() over 
hook_with_a_massive_switch_on($op).  I do agree that it is not clear 
when to return some tidbit for display and when to effect state but not 
return a value.  Hooks with switches do not imply "no return value" to me.

Drupal is a wonderful development platform.  One of my challenges with 
it continues to be why I would use a particular hook and where.  How is 
easy to glean from the golden code.  Hook names aid with the why and where.

Scott





-- 
*Scott McLewin*
www.folkjam.org
find jams. post jams. play well with others.
<http://www.folkjam.org>


More information about the development mailing list