[raleigh.rb] The cost/benefit of refactoring
Nathaniel Talbott
nathaniel at talbott.ws
Thu Dec 11 17:33:18 EST 2008
On Thu, Dec 11, 2008 at 3:21 PM, Ryan Daigle <ryan.daigle at gmail.com> wrote:
> I think I like the original code better. Easier to grok at a glance.
> Plus, I think a cool kid would like the original ones - you've got very
> small methods (3 lines each) and good structure within each method.
> Readability > smallest method possible
I think going for smallest possible method is dangerous, but my
concern is the duplication in the original. With just two methods, no
problem, but what if there were five? In that case I think pulling
that open block out would be a big plus. Not sure this is the best way
to do it (not enough context), but it seems reasonable.
As for readability, I think just taking the outermost block and making
it do/end instead of {/} would help a lot:
https://gist.github.com/34856/0817e7fefb30ace0e578fcdf2238ad4e6e515623
Just my $0.02,
--
Nathaniel Talbott
<:((><
More information about the raleigh-rb-members
mailing list