[Bioperl-l] method naming

Hilmar Lapp hlapp at gmx.net
Wed Jun 13 17:03:59 UTC 2007


We set a convention a while back on how to name these. It is  
implemented in the bioperl.lisp file (too bad no one is using emacs  
any more these days - it's a great editor), and in fact we started a  
renaming campaign (not sure when that was) on the SeqI and  
SeqFeatureI classes (you'll still see the old names aliased).

However, we never got to finish the clean up.

The convention was to use get_{ClassName}s, and get_all_{ClassName}s  
if there is a difference to the former (mostly because of  
hierarchical data; for example features can be nested, and  
get_all_SeqFeatures returns them all flattened out, while  
get_SeqFeatures returns only the top objects), and for modifying add_ 
{ClassName} and remove_{ClassName}s.

The class name was to be in title case to emphasize the fact that it  
is an array of object you'd be getting back (and what kind of  
objects). If it is strings or any other scalar type, the name would  
be in lower case.

	-hilmar

On Jun 13, 2007, at 12:14 PM, Chris Fields wrote:

> Some quick questions on method naming.  I couldn't find this on the
> mail list previously and just want some opinions.
>
> 1) Is there any preference on how to name a method that returns a
> list of class instances vs. data?  I have seen 'each' (each_Location,
> each_tag_value) vs. 'get_all' (get_all_tags, get_all_SeqFeatures) vs.
> simple (hits, hsps).
>
> 2) Do we want have methods which return objects have the object name
> in Title Case (each_Location, get_Seq_by_id, etc) or does it really
> matter?
>
> chris
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

-- 
===========================================================
: Hilmar Lapp  -:-  Durham, NC  -:-  hlapp at gmx dot net :
===========================================================








More information about the Bioperl-l mailing list