[Bioperl-l] method naming

Chris Fields cjfields at uiuc.edu
Wed Jun 13 17:19:43 UTC 2007

Sounds good.  I agree with Dave also one the use of 'each', as it's a  
bit ambiguous (seems to imply iteration as opposed to returning a  
whole list).

We probably need to post this somewhere on the wiki for future  
reference; maybe in Advanced BioPerl?  I'll add this in shortly.


On Jun 13, 2007, at 12:03 PM, Hilmar Lapp wrote:

> 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 :
> ===========================================================

Christopher Fields
Postdoctoral Researcher
Lab of Dr. Robert Switzer
Dept of Biochemistry
University of Illinois Urbana-Champaign

More information about the Bioperl-l mailing list