I still have nightmares too
My senior project in college was to update some code written in Fortran77 to simulate the recombination of antiprotons and positrons in the formation of AntiHydrogen. I needed to update the recombination algorithms to reflect current theory and optimize performance. It was horrible. I basically had to rewrite the entire program, and some of the problems were goto related. But I never blamed goto. I blamed the design principles (or lack of) of the original coder. The goto type statements were easy targets early on, because solid design principles were not formulated early on in programming language theory. And in place of general design principles, earlier principles tended to focus on linguistic characteristics of specific keywords. But we have evolved since then. Now design principles concentrate on logic flow, type principles, and general development consistency issues focused on the entire product path. I do not think it is legitamate or even good practice to substitue archaic practices for modern design principles. As our knowledge increases, we should replace old prejudices which, as I had surmised above, come from "gurus" of the past. I try not to hire those who lack understanding of good design principles, so that these wiley programmers won't be able to "maintain" my code in horrendous ways. Ways, I should add, that my previous posts show are not in any way to blame on goto.
I guess this is what I am asking for
Are there any problems with maintainability of a goto statement when the code is updated in a manner that follows good design principles? The design principles that I think are most relevant are:
- Variables (in any language) should be declared/initialized at the start of the code block in which they are used (a "Declared Use" idiom).
- Code blocks (in any language) should be as atomic as possible (an "Encapsulation" idiom).
- A naming convention for all identifier types should be agreed upon by the developers before production (a "Namespace Maintenance" idiom).
- The execution flow of a code block should follow in its reading the originally designed flow for the functionality desired (a "Flow Maintenance" idiom).
The point is that I do understand that the implementation will change as development progresses over the products lifetime. But, as long as design principles are followed, the implementation should never affect maintainability. This was the reason for the switch in linguistic research to form in the first place, ie. to provide for keyword independent rules that allow the creation of useable and maintainable code. If goto is an exception, then it is important to find out why because this would invalidate the current state of this line of research.
I am glad this thread is pursuing these issues, because it is very important to the entire field of general design principles, and I hope there will be more posting from all of those who have an interest in expanding this field.
So I will repeat my question. Are there any problems with maintainability of a goto statement when the code is updated in a manner that follows good design principles?
that argument seems to be a winner
jfaust, I concede to your superior debate move. Absolutely! It makes absolute sense. Because it should be a design principle that one should keep a branch connected to the logic of the branch. And so, this design principle invalidates the use of goto ever. Of course, I could argue that one could still use goto if the branch condition is connected to the goto in a complete statement group (if, goto) but then you have maintainability issues. Brilliant!
** galathaea spins melodramatically at the fatal shot to the heart **
Whispered, last gasp: "I have been fell by the greater rhetorics of jfaust. All should follow his advice. Never use goto."