Wednesday, November 2, 2011

Score Your Rails App's Complexity Before Refactoring

Every Rails developer must refactor their Rails code at some time. Ruby's dynamic nature makes it difficult for generic tools to understand what Ruby is doing though. Once you add Rails macros and metaprogramming into the mix you really need specialized tools when refactoring Ruby. In my last post I wrote about how to a generic tool called wc to find the complex code that needs to be refactored. wc's has many problems when checking Ruby code though:
  • it counts blank and empty lines
  • it counts lines with only comments
  • it counts only the number of lines, so each of these lines count as one even though the second is much more complex.
To overcome wc's limitations, we need to use a tool that is built specifically for evaluating the complexity of Ruby code.

Source: Ruby Inside

0 comments:

Post a Comment