From: "ara.t.howard" Date: 2007-12-11T05:05:36+09:00 Subject: Re: OCD, end statements, and vertical space On Dec 10, 2007, at 9:19 AM, Jay Levitt wrote: > > No matter how I space it, either the "end" statements look detached > from > their class, so nesting is hard to follow, or the def looks > detached, or > everything runs together, depending on how many lines are in the > routine, > how long the method name is, how many methods/classes are in a row, > etc. couple comments: - in vim, with ruby.vim and matchit, i can simply bounce on % to match do/end, module/end, class/end, if/else/end, etc. this works on keywords and, of course, "{}" braces. the result is that i hardly care about balancing ends visually since it's so easy to let my editor do it - folding compresses vertical space and reduces the problem by at least 80%. are you using a folding editor? here is what your code looks like to me (with some formatting of course) http://s3.amazonaws.com/drawohara.com.screenshots/vim.folded.ss. 49.png http://s3.amazonaws.com/drawohara.com.screenshots/vim.folded.ss. 50.png http://s3.amazonaws.com/drawohara.com.screenshots/vim.folded.ss. 51.png as you can see, the problem kind of goes away quickly when you simply eliminate the vertical space > > I can't find a spacing rule that I like more than 50% of the time. > Not 50% > of the *cases*, mind you - all the cases, just different solutions in > different moods. I'm pretty sure I spend 50% of my time deleting and > re-adding newlines on end statements :) > > Has anyone (as obsessive as I am) found a simple, aesthetically > pleasing > pattern to follow? I like programming to be art, but not > Colorforms art. why not 'space after the "end" except that last one: module Mod class Klass def one_method(param1, param2) puts puts "hello world" puts end def two_method puts "hello again" end end class NotherKlass def three_method puts "hi already" end end end ?? a @ http://codeforpeople.com/ -- it is not enough to be compassionate. you must act. h.h. the 14th dalai lama