Afficher un message
Vieux 14/04/2008, 01h37   #2
Bartc
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to design a program in C?


<istillshine@gmail.com> wrote in message
news:45d39ffb-0311-4650-8844-fea0b089f397@u36g2000prf.googlegroups.com...
> Particularly for medium-sized (10,000 ~ 20,000 lines) programs, what
> are useful strategies to design them before coding?
>
> My strategies are:


> 1. Imagine what the final program would look like. Write down
> options.
>
> 2. Write down many structures, such as
>
> struct s1 {
> /* contents */
> };
>

....
> 3. Write down many function prototypes, and classify them to different
> .h files.
>
>
> 4. Write many macro definitions, such as "#define MAX_SIZE 100"
>
> But having to change the original design during coding really troubles
> me. Do you have any suggestions to avoid doing this?


This is all stuff you learn as you attempt bigger projects.

Revising/refining projects is quite normal (they get easier 3rd or 4th time
round..).

In my case, as I'm not quite au fait with C, I might write in a more
familiar and less fussy language (especially rapid development) then port
the result to C. Then you don't have to dot the i's and cross the t's on
code which might change a dozen times more.

Other people will suggest some very formal methodologies, but I think an
informal approach can still lead to reasonable quality code.

--
Bart


  Réponse avec citation
 
Page generated in 0,04850 seconds with 9 queries