March 12, 2009

10 is the new 15

I’m on my lunch break and am reading a nice article about software architecture. I smiled (and then tumbl-tweeted) when I read a part that specifically called out method length as a sign of poor design. I’ve come to this conclusion lately and have been fairly vocal about it.

The author steps it up a notch though, asserting that 10 lines should be the maximum of any method in Java (he also points out comment delineation as code smell). If you have take in software architecture, it’s a good read.

1:02pm  |   permalink
"My rule of thumb on Java projects says that no methods should ever be longer than 10 lines of code. If a method exceeds that number, it is almost certainly doing more than one thing, which it shouldn’t do."

Evolutionary architecture and emergent design: Test-driven design, Part 1

12:50pm  |   permalink
FILED UNDER: programming best practices