[ImageJ-devel] Some Naming Issues in imglib2
Grant B. Harris
gharris at mbl.edu
Tue Jun 7 09:31:00 CDT 2011
All --
Curtis and I were considering the addition of methods for get/setting
the display scaling values and this drew our attention to some naming
issues that we may want to address. There are problems with both
semantics and style.
-- Semantics of Interval min/max:
In ImgPlus there are several methods names min and max which inherit
from Interval. Semantically, 'min' and 'max' should really be 'lower'
and 'upper' (or low/high, or lo/hi), as these fields refer to the bounds
or endpoints of an interval, whereas minima/maxima refer to the
smallest/largest values of a set or function.
-- Consistency, or lack thereof, with Accessors, Mutators, Creators…
We have generally used the naming style for accessors and mutators (for
data encapsulation), but there are many exceptions. While
getters/setters lengthens the calls, it really clarifies what a method
does. There are numerous other classes where we are inconsistent in
naming. For instance, in ImgPlus, get/set is not consistent for
dimension(), dimensions(), axis(d), axes(), and calibration(d). And
given that the methods cursor(), factory() and iterator() return newly
created objects, they should be createCursor(), createFactory() and
createIterator() respectively. Such changes would probably best be
propagated back into the ancestors of ImgPlus.
And there are, no doubt, other places where there are naming
inconsistencies, so if we decide to make changes we should probably run
a more thorough review.
These seem like significant inconsistencies which we should either fix
now or decide to live with. What do you all think?
-- Grant & Curtis
More information about the ImageJ-devel
mailing list