Ok. This IS homework ...

Magnus Lycka lycka at carmen.se
Thu Oct 19 10:36:38 EDT 2006


Frederic Rentsch wrote:
> Once upon a time programmers did things like this:
> 
>               BEGIN
>                 |
>  -------------->|<-------------------------------------
> |               |                                      |
> |           catch input                                |
> |               |                                      |
> |       input type valid? - prompt for correct input --|
> |               +                                      |
> |        input too large? + --- prompt for new input --
> |               -
> |      add to running total |               |
> |          status report |               |
>  -- - running total >= max?
>                 +
>            report done                  |
>                END
> 
> It was called a flow chart. Flow charts could be translated directly 
> into machine code written in assembly languages which had labels, tests 
> and jumps as the only flow-control constructs. When structured 
> programming introduced for and while loops they internalized labeling 
> and jumping. That was a great convenience. Flow-charting became rather 
> obsolete because the one-to-one correspondence between flow chart and 
> code was largely lost.

As long as you only draw your loops to the right (or left, just be
consistent) and make sure you don't cross any lines, you're doing
structured programming. (I think...)

E.g.

|
v
blah1<--------+
|             ^
v             |
if xx-->foo   |
|        |    |
v        v    |
bar     baz   |
|        |    |
+<-------+    |
|             |
v             |
maybe-------->+
|
v




More information about the Python-list mailing list