The main payroll program can now be expressed as a loop that parses transactions from an input source and then executes them. Figures 27-33 and 27-34 describe the statics and dynamics of the main program. The concept is simple: The PayrollApplication sits in a loop, alternately requesting transactions from the transactionSource and then telling those transaction objects to Execute. Note that this is different from the diagram in Figure 27-1 and represents a shift in our thinking to a more abstract mechanism. Figure 27-33. Static model for the main program
Figure 27-34. Dynamic model for the main program
transactionSource is an interface that we can implement in several ways. The static diagram shows the derivative named TextParserTransactionSource, which reads an incoming text stream and parses out the transactions as described in the use cases. This object then creates the appropriate TRansaction objects and sends them along to the PayrollApplication. The separation of interface from implementation in the transactionSource allows the source of the transactions to vary. For example, we could easily interface the PayrollApplication to a GUITransactionSource or a RemoteTransaction-Source. |