CrudVision - Lisa Seelye

September 17, 2007

Refactoring Rails

Filed under: RailsConfEurope, RailsConfEurope07, rails, testing — Lisa Seelye @ 11:44

I must say that Trotter Cashion’s presentation on refactoring wasn’t totally new material. At work we have at least one project that desperately needs some refactor/rewrite love. I’m hoping to convince bossmen that it’s a good idea to rework its source. ;)

One of the things he mentioned is that not refactoring is like accruing debt. It made sense immediately. I’ve said before that it’s easier and more fun to work with a codebase that is well written and easy to read. Not refactoring (or rewriting when necessary) is the way to not give yourself a good codebase. No one can, from the start, architect the perfect application, code, or methods. Cruft begins to collect when the coder is under time constraints and begins to hinder work because cruft on top of cruft means a lot of searching to find out what the code is doing before anything can be done!

The next session is the “Flex on Rails” tutorial and that should be painful and evil.

1 Comment »

  1. This idea of accruing ‘code debt’ really does help make it clear why it is important to be refactoring.

    We often are forced to do kludgy things when we are time and resource constrained, and this is where we start getting code debt. As long as you don’t ‘pay off’ your debt, it starts earning interest. The more debt your project has, the more risk it is exposed to.

    Maybe interface sucks, so it’s hard to grok, and so is harder for new people to pick up. Maybe it has severe architecture implications, and you are forced to do hackish workarounds, resulting in more debt in the process. It can be a vicious cycle.

    Really though, if you don’t regularly spend time paying down code debt, you’re going to have a bad time.

    Comment by Joshua Nichols — September 17, 2007 @ 19:33

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress