[Wtr-general] 1 Questions for Watir's creators

2007-04-08 Thread ftorres
I guess the question is for Bret 

[1] What are the pros and cons of naming a method bring_to_front rather than 
BringToFront.

Thanks.

Fred.

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Re: [Wtr-general] 1 Questions for Watir's creators

2007-04-08 Thread Charley Baker

Hi Fred,

  It's standard ruby coding conventions, this style of naming is used in
ruby not camel cased as is prevalent in Java and c/c++. Take a look at the
Ruby coding conventions doc:

http://pub.cozmixng.org/~the-rwiki/rw-cgi.rb?cmd=view;name=RubyCodingConvention

The naming conventions lists naming conventions for classes/modules and
methods, variables, constants.  Class names are constants in Ruby internally
and must begin with an upper case letter.

Try the following:

class dog
 def bark
   puts 'woof'
 end
end

d = dog.new
d.bark

You'll get a compilation error that class/module name must be a CONSTANT -
must begin with an upper case letter. Method names therefore begin with a
lower case letter to differentiate and use underscores to separate words not
camel case. This matches variable names which in some cases - attributes
notably - are basically interchangeable.

-Charley

On 4/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:


 I guess the question is for Bret

[1] What are the pros and cons of naming a method bring_to_front rather
than BringToFront.

Thanks.

Fred.



___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

___
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general