One of the fundamental attributes of structured programming is the
subroutine, preferably of reasonably size.
I think we can debate as to exactly which aspects of structured
programming are the most important, but that's unlikely to achieve
much useful, but FWIW, my opinion is that cohesive and reasonably
sized subroutines are actually the fundamental building block of
clearly written programs. So it's really decomposition, and the skill
set to achieve it, that was missing from those monster unstructured
programs.
I do agree that thinking about programs in a structured way leads to
better programs (usually), but the end goal has to be something
practical, like more understandable programs. Otherwise it's just
another pointless academic exercise. In that context the lack of
structure implied by hundreds of gotos jumping willy-nilly over a
10KLOC mass of code is pretty mindboggling (if you haven't seen it,
you probably can't imaging just how bad it can be). By contrast,
while it might not be ideal, over the span of a 50 line routine, it's
a pretty minor issue. Scale is very important here.
Many people (pre-Dijkstra) writing those large programs understood at
least some of that, at least in an informal sense, and worked hard to
impose some sort of organization on their programs, although were
often hampered by poor tools (a lack of proper subroutines in Cobol*,
for example). Unfortunately programs have always had a tendency to
evolve, and that evolution is far too often done under time and const
constraints, and thus often involved violence to any "structure" in
the program. That's still true today, of course.
A similar situation are the extensive discussions of methodologies for
the development of large systems. While we can debate which
methodology we might prefer, I think we'd all agree that having *some*
plan for managing a large project is important. OTOH, if you're
writing a 1KLOC program, it just doesn't matter. Again, scale is
important.
So in the end, if everyone had been writing mostly ~50 line routines,
I don't think the lack of structure within those routines would have
attracted too much attention.
*Notwithstanding the dozens of books, papers and classes on doing
structured programming in Cobol. Until later versions of the language
this was really little better than doing structured programming in
assembler or OOP in C (both of which are obviously possible, and often
practices followed by programmers, but the tools aren't really
providing any support and that structure, or OOP, is being done
manually).
>> In most cases, with "modern" sized functions, even grossly
>> unstructured and goto-laden code would be much less of a problem.
>> The amount of control flow insanity possible in a 50 line routine
>> is inherently limited.
>
>Limited? Yes. Limited enough so that it's never awful? I have
>to give a No on that one. :)
You can, of course, write awful 50 line routines using only the three
basic SP control flows.
As I've said before, this is all about clarity, not following some
arbitrary set of rules*. I'm good with whatever makes a program
clearer. On occasion, that involves a goto. We know you *can* always
do without, but sometimes the cure is worse than the disease.
*Although in some cases arbitrary rules are a source of clarity. For
example, having a shop standard for brace placement - which placement
style you pick is pretty arbitrary**, but having everyone follow that
style, at least within a project, it quite helpful.
**So long as you pick the one obviously correct style. ;-)
>> That's made even better when you restrict goto usage to one of a
>> few idioms which are well understood, and straight-forward.
>
>Here you are using "idioms" more or less as a synonym for
>"patterns". When used as a count noun, "idiom" has the meaning
>of "peculiar construct", not "conventional pattern". It's
>different when "idiom" is used as a mass noun, but that's not the
>case here, as mass nouns aren't used in the plural. "That's made
>even better when you restrict goto usage to one of a few common,
>straightforward, and well-understood patterns" is what I think
>you mean to say. (And if it isn't then I have misunderstood you
>and hope you will explain.)
My experience is that those usages are pretty much interchangeable in
the field. Although I'd agree that in linguistic terms they're not.