From: Fabian Streitel Date: 2009-08-31T17:55:05+09:00 Subject: Re: What is the ruby conventions to name private method? --001517441366665c7804726c3072 Content-Type: text/plain; charset=ISO-8859-1 I name them like any other method. If you look at the Standard Library classes, they do so too. Like Object, for example: 002:0> Object.new.private_methods => ["exit!", "chomp!", "initialize", "irb_eval", "fail", "print", "binding", "irb_binding", "split", "Array", "gem", "format", "chop", "iterator?", "catch", "readlines", "trap", "remove_instance_variable", "gem_original_require", "getc", "returning", "singleton_method_added", "caller", "putc", "autoload?", "proc", "pp", "chomp", "block_given?", "throw", "p", "sub!", "loop", "syscall", "trace_var", "exec", "Integer", "callcc", "puts", "initialize_copy", "load", "x", "singleton_method_removed", "exit", "srand", "lambda", "y", "DelegateClass", "get_line", "global_variables", "gsub!", "untrace_var", "print_line", "open", "`", "method_missing", "system", "Float", "require", "gets", "abort", "sub", "singleton_method_undefined", "get_lines", "test", "rand", "eval", "warn", "local_variables", "chop!", "fork", "set_trace_func", "printf", "raise", "scan", "Rational", "String", "sleep", "select", "gsub", "sprintf", "autoload", "readline", "at_exit", "__method__"] Except for some rare cases where __something__ is used, but those are ruby core methods and you shouldn't use that pattern. 1) Don't use underscores in class names. > yep. > 2) Don't have extra empty lines for no reason. > I count better readability as a good reason. > 3) Use 2 spaces per indent. > I like 4 better > 4) Don't have private methods if you don't need them. > I agree. > 5) You don't need them. No, really. > You sometimes do, if you want to be DRY. All those styling conventions are 100% subjective. [removed styling advice] Although you didn't ask for styling guide, here we are again... :-) It's too damn easy to slip into that topic... I had already written 3 paragraphs. --001517441366665c7804726c3072--