From: "David A. Black" Date: 2007-10-18T23:27:04+09:00 Subject: Re: Naming Conventions Hi -- On Thu, 18 Oct 2007, John Joyce wrote: >> >> The choice is yours. :) >> > Yes. You can do as you please. > >> Where the style counts more though is in terms of casing. So for instance: >> >> * Constants start with a capital letter. >> * Method names are in snake_case. >> * Class names in CamelCase. > > ModuleNames are also camel cased. > > Other tip: > use do and end for multi-line blocks > use {} for single line blocks > It's not a rule, just by convention. > > Other other tip: > Rails is not necessarily an example of Ruby. It's an example of Ruby's > tendency to become a DSL. > Many gems will show you different looking but similarly developed > not-typical-Ruby-looking style. > There seems to be a tendency for DSL-like things in Ruby projects as they get > developed. > I think this is a result of Ruby being very very OOPy and very flexible. > So don't be surprised when some things seem to have their own conventions > contrary to "standard" (?!) Ruby On the other hand... Rails does a lot of things in conformity with traditional Ruby style, which I think is very good and perhaps very shrewd. The main departure is a lot of method calls without parentheses. But the Rails code adheres to two-space indenting, standard use of this_style and ThisStyle in the appropriate places, and other standard stylistic things that people are often fond of pushing aside. David -- Upcoming training from Ruby Power and Light, LLC: * Intro to Ruby on Rails, Edison, NJ, October 23-26 * Advancing with Rails, Edison, NJ, November 6-9 Both taught by David A. Black. See http://www.rubypal.com for more info!