"Michael Neumann" <mneumann / ntecs.de> schrieb im Newsbeitrag
news:20041021091218.GC983 / miya.intranet.ntecs.de...
> Hi,
>
> For method names that contain up to two words, I really prefer the
> underscore-case (e.g., has_key?, method_missing). But if the method name
> contains more than two words that starts to look ugly IMO. It even looks
> strange (IMO) if you use underscore-case very often in your program
> (everything is small, no contrast for your eyes):
>
>   c.form.url("foo").with {
>     c.table {
>       c.table_row.id("myrow").with {
>         c.table_data.align_top.col_span(3).with("Hello world")
>       }
>       c.table_row_with_data {
>         c << "Foo:"
>         c.text_input.value(myobject.foo).callback(myobject, :foo=)
>       }
>     }
>   }
>
> Versus:
>
>   c.form.url("foo").with {
>     c.table {
>       c.tableRow.id("myrow").with {
>         c.tableData.alignTop.colSpan(3).with("Hello world")
>       }
>       c.tableRowWithData {
>         c << "Foo:"
>         c.textInput.value(myobject.foo).callback(myobject, :foo=)
>       }
>     }
>   }
>
> (and if you know that there's a class TableData, shouldn't the method be
> named tableData instead of table_data ?)
>
> I know that underscore-case is the perfered way in Ruby.
>
> Some more examples:
>
>   render_content_on <-> renderContentOn
>   render_table_header_on <-> renderTableHeaderOn
>
> Which one would you prefer? Thanks.

I'd stick with underscore style.  IMHO readability is not really improved
with camel case (might depend on screen, font and coloring though) and the
only advantage is that you save some chars.

It might be different for you but I have to use more than three
identifiers separated by a dot very rarely; so from my personal experience
the example you showed seems to be rather exceptional than regular - YMMV
though.  I don't know the classes of your example so I don't know whether
these chains *have* to be there because all invocations create new
instance.  If not, i.e., if some of those methods just return self, I'd
rather resort to multiple lines with individual invocations.

My 0.02EUR...

Kind regards

    robert