From: Raul Parolari Date: 2007-11-27T06:23:08+09:00 Subject: Re: False positives in editing data RichardOnRails wrote: > I like to know merely by inspection whether a referent denotes an > integer, a string, a hash or an array of such things. I'd like to > avoid "Syntax error" simply because I failed to include a to_s, to_i, > [] or whatever. I really can't see why a prefixed lower-case letter > or two before a camel-case object name can create so much discussion > irrelevant to the question at hand. Richard, I always found fascinating the issue of 'how we name things', and not only for philosophical reasons; personally I think that the horrendous amount of time spent to-day in what is called "Testing Dept" is due in part to problems like that. A bad and careless Naming methodology (when there is one!) leads (especially in a project where people share code) to subtle errors, flawed assumptions, and ultimately to errors (unfortunately, when there is somebody put in charge of the 'naming standards', he is often very politically correct, but not the brightest guy around, and the result is even worse than 'no standards'). One person who wrote something intelligent about this subject is Damian Conway in his book "Perl Best Practices" (ok, I will get the usual parochial boos for naming that language, but ok, life continues), specifically chapter 3 "Naming Conventions". Even if the examples are on Perl syntax, the substance goes beyond. He suggests something different than your approach; the name should indicate not so much the class/type, but the MEANING of the data structure; for example (of course I will not use Perl syntax, and avoid the examples that make sense for Perl only): # scalars running_total games_count # (rather than 'total','count') # booleans is_valid has_end_tag loading_finished # arrays events handlers unknowns # the iteration var event handler unknown # hashes title_of count_for sales_from isbn_from He even discusses the role of 'nouns' and 'adjectives' in names.. (a delight to read!). The emphasis is in the MEANING of the data, not on the 'class/type': do you see? but the objective is similar to yours: grant somebody looking at code of somebody else (translated: ourselves 6 months later!) at least a hope to vaguely understand what is going on! You may want to glance at it, if you find that approach of interest. Raul Names are but noise and smoke, obscuring heavenly light Johann Wolfgang von Goethe, "Faust: Part I" -- Posted via http://www.ruby-forum.com/.