Thought-provoking article on code refactoring

Posted: March 24th, 2008 | Author: Ken Youens-Clark | Filed under: Programming | 1 Comment »

Saw this linked from Slashdot.


One Comment on “Thought-provoking article on code refactoring”

  1. 1 pasternak said at 4:19 pm on March 25th, 2008:

    Interesting article. I really like the ideas in there. The blogger somewhat short sells the very real advantages of looking at code from far away. Just three things you can tell right away:

    • Long routines: Unless you’re programming Ulysses-style, the code should be split into small, bite-sized methods.
    • Repeating code blocks: If you follow DRY (Don’t Repeat Yourself), you should not see any obvious repetitive structure.
    • Heavy indentation: Good code should not have to be indented more than 3 or 4 tab stops. More indented blocks should be extracted into separate methods.

    You can tell these by looking at the code from high up. We should try something like that as a code review exercise.


Leave a Reply