in reply to efficient use of subroutines
Several people have said that a subroutine should "do one thing." In that spirit, there is a simple test for whether or not a block of code should be a subroutine. If the code can be completely described in one sentence with no 'and', 'or' or 'but', it probably should be a subroutine.
Note: This is not an original idea. It is paraphrased from Yordon and Constantine's 1979 book "Structured Design"
UPDATE: Corrected Reference.
|
|---|