Re: [Q] big function vs many small functions
- From: Steve O'Hara-Smith <steveo@xxxxxxxxxx>
- Date: Tue, 25 Sep 2007 16:56:41 +0100
On Tue, 25 Sep 2007 15:34:38 +0100
Steve O'Hara-Smith <steveo@xxxxxxxxxx> wrote:
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
ye gods what happened to that :(
I was about to say that it is probably better to redesign the
program to avoid the big switch.
--
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/
.
- References:
- [Q] big function vs many small functions
- From: t.j.
- Re: [Q] big function vs many small functions
- From: Steve O'Hara-Smith
- [Q] big function vs many small functions
- Prev by Date: Re: [Q] big function vs many small functions
- Next by Date: Re: An interview question
- Previous by thread: Re: [Q] big function vs many small functions
- Next by thread: Re: big function vs many small functions
- Index(es):
Relevant Pages
|