[Q] big function vs many small functions



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?


.



Relevant Pages

  • Re: Roles question
    ... account for that, and a switch statement won't handle that. ... >I am writing an application using the ASP.NET Configuration Roles and ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Which of switch statement and if-else statement takes less time to execute?
    ... > Which of switch statement and if-else statement takes less time to ... thing, the performance difference, if any, will not be consistent from ... use an if-else chain for everything else. ... For example, writing ...
    (comp.lang.c)
  • Re: [Q] big function vs many small functions
    ... each case inside of the function containing the switch statement. ... Another would be to have an individual function for each case statement. ... I recall reading something where someone actually studied this situation ... and determined there was no meaningful difference between the two. ...
    (comp.programming)
  • 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)
  • Re: Sort of Gray code to binary converter
    ... Binary tree, table, hash, etc. ... If a large enough switch statement where an 8 bit switch argument ... Writing it in if/else form, ... cleverness, if any, has to come from the compiler if you depend on the ...
    (sci.electronics.design)