From: Stefan Schmiedl Date: 2004-10-22T16:49:18+09:00 Subject: Re: CamelCase issues On Fri, 22 Oct 2004 07:36:12 +0900, Michael Neumann wrote: > On Fri, Oct 22, 2004 at 05:49:20AM +0900, Stefan Schmiedl wrote: >> On Thu, 21 Oct 2004 18:12:23 +0900, >> Michael Neumann wrote: >> > Some more examples: >> > >> > render_content_on <-> renderContentOn >> > render_table_header_on <-> renderTableHeaderOn >> > >> > Which one would you prefer? Thanks. >> >> Actually, I'd prefer >> >> content.render_on and >> table.header.render_on > > Hm, sure, but I've to create the content or table.header object > somewhere. Yes, that's the point. Long method names as in your example sometimes point towards missing objects. > > It's similar as in the following example (where render_table_header_on =~ draw_line_on): > > def draw_line_on(canvas, x, y, w, h) > ... > end > > def draw_box_on(canvas, x, y, w, h) > ... > end > > def draw_on(canvas) > draw_line_on(canvas, ....) > draw_box_on(canvas, ...) > end Who does all of this drawing? It looks like some unknown power is doing (and knowing) way too much. class Painter def draw_on(canvas) canvas.draw(contents) end end module Canvas def draw(commands) commands.each do |cmd| ... end end end class GUICanvas include Canvas def line(x0, y0, x1, y1) moveto(x0, y0) lineto(x1, y1) end def box(l, t, w, h) line(l, t, l+w, t) ... etc end end def PSCanvas include Canvas def initialize(out) @out=out end def line(x0, y0, x1, y1) out.puts "#{x0} #{y0} moveto" out.puts "#{x1} #{y1} lineto" end ... etc end > > Of course I'd removed the "_on" in the GUI case. > The actual "drawing" is done this way (inside render_xxxx_on): > > renderer.table { > renderer.row { > ... If I were the renderer, I'd have a headache from all the knowledge that you must have stuffed into my poor brain :-) There must be a better way to do this. >> but I'm not sure if that's an answer to your question :-) > > any answer is :) I'll remember this, Michael ;> s.