1. Introduction

Software development is as old as human history, it has given us many a religious belief system, used to control human brains, ultimately eliciting desired behavior in the attached human body.

2. Software development model

@startuml

state "Design" as D
state "Design Review" as RD
state "Implementation" as I
state "Implementation Review" as RI
state "Refactoring Review" as RR

[*] --> D

D --> RD : finished
RD --> D : rejected
RD --> I : approved
I -->  RR: problem
RR --> D : re-design
RR --> I : documentation only\n"known bug"

I -->  RI: finished
RI --> RR : rejected
RI --> [*] : approved

@enduml

3. Control Structures

All control structures can be reduced to a conditional jump (see Control Structures (German)).

The unconditional while loop (endless loop) with a break before the repetition can be used to simulate complex free form case / when structures that do not fit the if / elseif cascade nicely.

With a conventional while loop, initialization/continuation code:is somethimes duplicated (see listing 3.1).

listing 3.1 duplicated init/cont code
1
2
3
4
ch = get_char()
while ch != EOF:
    print(ch)
    ch = get_char()

listing 3.2 shows, how this duplication can be avoided.

listing 3.2 single instance of init/cont code
1
2
3
4
5
while True:
    ch = get_char()
    if ch == EOF:
       break
    print(ch)

Another common problem is found in shell scripts, when it is necessary to determine whether one or more files actually exist (see listing 3.3).

listing 3.3 file existence check
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# clear first_readable                                             #a0 :;
first_readable=
# while (for each _file in screenlog.?) is (do)                    #a0
for _file in screenlog.?;
do
    # if (_file is **not** readable?) then (yes)                   #a0
    test -r "${_file}" ||
        break                                                      #a0
    # endif                                                        #a0
    # set first_readable = "${_file}"                              #a0 :;;
    first_readable="${_file}"
    break                                                          #a0
done                                                               #a0
# if (first_readable is empty?) then (yes)                         #a0
test -z "${first_readable}" && ...
# endif                                                            #a0

figure 3.1 shows the logic behind the file existence check.

@startuml /' a0 '/
skinparam padding 1
start
  :clear first_readable;
   while (for each _file in screenlog.?) is (do)
       if (_file is **not** readable?) then (yes)
           break
       endif
       :set first_readable = "${_file}";
       break
   endwhile
   if (first_readable is empty?) then (yes)
   endif
stop
@enduml

figure 3.1 activitiy diagram for file existence check