The next statement after the conditional is the
Mail action, which the main sequential program recurses to. The resulting structure is
thus more similar to howa compiler might parse the program: at the top level there are
288 GENERATOR DEFINITION
FIGURE 11.1 Rejoining versus subordinate condition
three instructions, the second of which contains its own subtree. A generator might
look something like Listing 11.9.
Listing 11.9 Generating subordinate conditionals.
Report 'handleObject'
if type = 'IF' then /* conditional object */
'IF' :Condition 'THEN'
do ~From>Yes~To.() /* new recursion down Yes path */
{
subreport 'handleObject' run
}
'ELSE'
do ~From>No~To.() /* new recursion down No path */
{
subreport 'handleObject' run
}
'END IF'
else
:Command /* simple object */
endif
do ~From~To.() /* main flow recursion */
{
subreport 'handleObject' run
}
GENERATOR OUTPUT PATTERNS 289
As we will see below, we are not forced to change the modeling language to
cope with IF: the other option is to change the generator structure. Before we look
at that, we ought to consider GOTO. This may seem a terrible regression: surely
DSM is meant to be about best practices, yet here we are talking about a structure
that has been frowned on for nearly 40 years. Why then is GOTO not considered
harmful in modeling languages? One main reason is that the path of control is far
clearer in a graphical model: we can see a line from each GOTO call site to the
code it calls.
Pages:
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536