From: "David A. Black" Date: 2004-03-24T08:18:02+09:00 Subject: Re: Need some advice on PickAxe II Hi -- On Wed, 24 Mar 2004, Ben Giddings wrote: > Dave Brown wrote: > > In article <40607376.2000802@infofiend.com>, > > Ben Giddings wrote: > > : Trying to understand your religion here. If both methods and variables > > : are named with underscores, not camel case how do you distinguish beween > > : a method that instructs something to read a certain number, and a > > : variable which keeps track of how many times something was read. > > : read_number vs. read_number. > > > > read_number <= reads a number > > number_read <= number of times something was read. > > > > If an attribute name is a verb (or verb phrase), it does something. If > > it's a noun, it is something. > > My point is that 'read' is both a verb and a noun. So is 'hit' and > 'run'. Sometimes whether something is a verbal phrase or a noun depends > on how you read it. > > What's the problem with making it more visually distinct? > > readNumber <- reads a number > number_read <- the number of times something was read But then someone else might do: read_number # method numberRead # variable so there's no net gain in clarity. I personally think that this is, in any case, a solution in search of a problem -- but my point is that it isn't even really a solution :-) Of course people could agree on a convention for which is which -- but then the question is, when does the cycle of replacing conventions end? > Now I don't care if number_read is actually done via a method that does > some calculation before returning a value. It *acts* like a > variable/attribute, so it can be documented as if it were one. > > What's the argument against this style of naming methods, aside from > personal aesthetics? I'd turn the question around. Aside from personal aesthetics, what purpose is served by departing from traditional style? Why the need to cast about for new, visually incongruent elements of style for Ruby? David -- David A. Black dblack@wobblini.net