Re: [Q] big function vs many small functions



On Tue, 25 Sep 2007 12:30:06 GMT
tekenen@xxxxxxxxxxx (t.j.) wrote:



Let's say that one has a function with a large switch statement with
many case statements.

One way of writing the function is to just place all of the code for
each case inside of the function containing the switch statement.

Another would be to have an individual function for each case statement.

Which way is better in terms of maintainability and frequency of bugs?

If you can get the switch down to readable size using an individual
function for each case that will help. OTOH if you cannot then it is probab

I recall reading something where someone actually studied this situation
and determined there was no meaningful difference between the two.
Anyone else come across the same thing?




--
C:>WIN | Directable Mirror Arrays
The computer obeys and wins. | A better way to focus the sun
You lose and Bill collects. | licences available see
| http://www.sohara.org/
.



Relevant Pages

  • Re: [Q] big function vs many small functions
    ... One way of writing the function is to just place all of the code for ... each case inside of the function containing the switch statement. ... Another would be to have an individual function for each case statement. ... program to avoid the big switch. ...
    (comp.programming)
  • [Q] big function vs many small functions
    ... One way of writing the function is to just place all of the code for ... each case inside of the function containing the switch statement. ... I recall reading something where someone actually studied this situation ... and determined there was no meaningful difference between the two. ...
    (comp.programming)