Extreme refactoring?

Brian Button has written a demo of extreme refactoring using the following rules:

  1. Methods should be 1 line long. Anything longer than that needs to be looked at closely.
  2. Aggressively eliminate all duplication, specifically duplication involved with iterating over containers several different times in similar ways
  3. Use no private methods.

The first rule seems fundamentally flawed to me. At the point where you sacrifice clarity for brevity, you end up with software that doesn't do its job properly. That is, the software no longer clearly indicates its intent, and becomes makes life harder for the people who are maintaining it.

I noticed however that Brian's code isn't at all difficult to read. But remember that the task he's working with is a very simple problem. I believe (and have seen from experience) trying to get complex algorithms down to one-line methods can often obscure the intent of the code.

That's not to say simplicity isn't the goal. But shortest isn't always the simplest.

Portrait of Matt Ryall

About Matt

I’m a technology nerd, husband and father of four, living in beautiful Sydney, Australia.

My passion is building software products that make the world a better place. For the last 15 years, I’ve led product teams at Atlassian to create collaboration tools.

I'm also a startup advisor and investor, with an interest in advancing the Australian space industry. You can read more about my work on my LinkedIn profile.

To contact me, please send an email or reply on Twitter.