Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I recall a methodology that emphasized making functions short and numerous. It said that if a section of code can be separated at all, it should be, even if the resultant functions are only used once. Some argue that it's DRY taken too far, and that this kind of obsessive refactoring is counterproductive.

Does anyone know what it could be called? I don't think it actually had refactoring in the name.

share|improve this question
    
I would suggest that is a leaning towards developing best practices by following along the design principles of the Single Responsibility Principle and Don't Repeat yourself. Maybe a bit of KISS as well. –  dreza Jan 12 '12 at 20:18
    
Code that is "modular" sometimes has the attributes you describe. –  Pete Wilson Jan 12 '12 at 20:23
    
As an aside, this seems to come naturally out of literate programming. –  Maxpm Jan 12 '12 at 20:27
    
It sounds more like Death by Spoon. –  Mike Nakis Jan 12 '12 at 20:36
1  
Structured Programming –  Paul Jan 12 '12 at 21:05
show 2 more comments

2 Answers

up vote 10 down vote accepted

Martin Fowler's Refactoring book identifies long methods as a code smell, with the Extract Method refactor being a solution.

I think it could also be considered a derivative of the Single Responsibility Principle. Applying it at the method level can make unit-testing much easier, since you don't have to worry about testing multiple results from a single tested method.

It could also be called Short Methods; the link has a good discussion of this methodology. The point is that we can only keep in our minds around 5-9 things at one time, so shorter methods allow us to abstract away some bit of logic whose implementation is unimportant at the point where it's used.

share|improve this answer
add comment

Sounds like an extreme version of Modularization

this kind of obsessive refactoring is counterproductive.

That's called "Modularize, not atomize" ;-)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.