Re: C question!
- From: Robby <Robby@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 12 Aug 2008 11:51:03 -0700
Yes Tim, you are right!
Excuse me if I didn't make myself clear. But I am using an array, for I
didn't find a structure convenient in this case.
Thankyou for your concern!
--
Best regards
Robert
"Tim Roberts" wrote:
Robby <Robby@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:.
Yup, then I shall just keep it the way I had it.
I'd rather not get too fancy!
OK, now I have to chime in.
This is not about being "fancy". This is about good, basic software
engineering techniques. One of the most fundamental computing principles
is DRY: Don't Repeat Yourself. Anytime you find yourself doing something
repetitive, you have an opportunity to replace that with an iterative loop.
This pays huge and tangible benefits. First, when you repeat code, you
introduce many opportunities for bugs and typos. Second, when you have to
modify the code, inevitably you will forget to update one or more of the
repeated sections. Third, sooner or later you are going to want to add
more: more cases, more variables, etc. With a loop, those added cases cost
you nothing -- just increase the loop count. With repeated, you have to
cut-and-paste more copies, possibly in multiple places.
Do the right thing. Stop right now, and change your code to use an array
instead of a structure with MSG1, MSG2, MSG3, MSG4, etc.
--
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.
- References:
- C question!
- From: Robby
- Re: C question!
- From: Igor Tandetnik
- Re: C question!
- From: Robby
- Re: C question!
- From: Tim Roberts
- C question!
- Prev by Date: Re: C question!
- Next by Date: Re: Another C question!
- Previous by thread: Re: C question!
- Next by thread: achat zocor belgique au rabais en ligne sans prescription Achat achat zocor Pro achat zocor suisse soft sans prescription generique medicaments en France acheter zocor suisse pharmacie
- Index(es):
Relevant Pages
|