From: itsme213 Date: 2004-11-14T09:43:24+09:00 Subject: Re: ruby sections? "Jamis Buck" wrote in message > Hmmm. This is just me, but when I find myself with a method that can be > logically broken down into different functional parts, I typically > refactor the method, so that each of those parts is another method. Sometimes this is a good choice. At other times it becomes contorted since it loses shared context (local variables, parameters of the parent method) and so adds unnecessary parameter passing. I was talking about those other times. def foo (w, x) # section 1 y = a(w) z = b(y) # section 2 ... end > And if I find that I have methods that should be grouped in clusters, I > typically refactor _those_ into new classes, so: Again, sometimes this works. You lose the shared context of the class (instance variables etc) and that sometimes makes things contorted, imo. Sometimes defining a module inline + including it immediately works too. > AND, if I find that I have classes that need grouping, I refactor them > out into new modules...and so forth. Similarly, sometimes a good approach. Just mho.