At what point is a rewrite warranted?

fishinginthecoy
Thu, 31 May 2018 01:45:12 +0000

[Context: I do computational research in the natural sciences.]

I have been tasked with verifying the correctness of a ~3000 LOC software project written in a mix of Fortrans 77 and 90. I have made some small amount of headway with getting the program up and running, but it seems like every time I make one step forward I take ten steps back.
Some issues with the program:

It only compiles with one, specific, closed-source compiler

Useless variable names

Minimal comments (the ones that do exist are near-gibberish, explain the obvious, or comment out debugging print statements)

Weird decisions are made with no justification, e.g. the code author decided that, if we are considering the calculations on the first molecule, we are only to consider its first atom

Magic numbers everywhere, very few of which are known physical constants or their conversions

etc, etc, etc.

I am reaching peak frustration after having worked with this code for only a few weeks. At this point, the idea of sitting down and rewriting the program from scratch is very, very tempting.
Do I need to just step back, relax, and keep hitting my head against the wall, or is this a situation where a rewrite may be necessary?

Comments URL: https://tildes.net/~comp/146/at_what_point_is_a_rewrite_warranted

Votes: 12

Comments: 11