[raleigh.rb] The cost/benefit of refactoring

Nathaniel Talbott nathaniel at talbott.ws
Thu Dec 11 15:21:59 EST 2008


On Thu, Dec 11, 2008 at 2:49 PM, Jonathon Brenner <jon.list+rb at gmail.com> wrote:


> The original code is commented out. The new refactored code passes lambdas
> to the "manager" method. My issue basically boils down to redundancy versus
> complexity:
> - The original code is simpler for both me and ruby (it flogs lower due to
> the lack of the lambda calls).
> - The new code only only calls SNMP::Manager#open in one place, which makes
> it easier to change the call later.

I put it on gist and did an edit that should take your flog score down:

  https://gist.github.com/34856/57dcba7a6c8247d8a57f3b40ba27f91fc5a8b1a6

Basically, you can use the block directly without using a lambda.

In general I like your refactoring, since it cuts down on the duplication.


-- 
Nathaniel Talbott
<:((><


More information about the raleigh-rb-members mailing list