James said:
Hi,
Recently my boss has given me a huge program (10000) lines of code.
The program has be written in an unmaintainable fashion.
It looks like someone who did not know programming has written it.
The program is written in such a fashion that it is a miracle that it is working.
Now, My job is to rewrite the program in a professional fashion.
Can you write a program from scratch in a 'professional
fashion?'
The problem is where do i start. How to begin ?
No offense intended, but if you don't know how to begin,
I suspect you're not the right person for the job.
I've had to do similar work more times than I care
to recall during my career -- it's typically no
simple task, even for folks with much experience.
A few times it was deemed more efficacious to rewrite
from scratch, instead of trying to 'fix' the 'spaghetti
code'. Of course your circumstances might prohibit this,
I don't know.
About all I can offer someone who says 'where do I start'
is to recommend Fowler's book "Refactoring" and similar
works. See
http://www.refactoring.com/
BTW your query isn't about C, which is the topic here.
Information on the topic, nature, and guidelines of
comp.lang.c:
http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html
Experienced programmers please advice.
My experience combined with the nature of your request
and your apparent lack of direction causes me to advise
the hiring of someone who does know how to do it (best
if (s)he's done it a few times already.)
I'm not saying you're completely incapable of doing this,
but if there are time constraints, well ....
And don't forget the time needed for testing and debugging.
Final note: Don't try to determine what the program does
and how by reading the code. Read the specification.
If there isn't one, tell your boss you need one. You
might write one together, if you both have sufficient
knowledge of the program's purpose. You will have a
much better chance of success if you're coding to a
specific, detailed description.
HTH,
-Mike