Re: big function vs many small functions



On 25 Sep, 13:30, teke...@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?

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?


Separate functions. I've seen code with switches inside switches.
Nasty.

.



Relevant Pages

  • How fast should this execute??
    ... hope someone might answer.I am writing a program that requires about 86 ... to be about 6 hours.I have tryed several switches for the compiler ... .The -o1 etc doesnt seem to work as I get an error ...
    (alt.comp.lang.learn.c-cpp)
  • Split dataset at avriable points using sort
    ... want to stop writing the records, or even write them to a second file. ... Write the records to File1 until a record with value 'X' is located. ... Continue writing to File1, etc. ... maybe switches back.. ...
    (bit.listserv.ibm-main)
  • how to do -vv for very verbose?
    ... I'm using optparse.Optionparser to take switches for a script I'm writing, but I can't see how to give it -vv for very verbose. ...
    (comp.lang.python)