next up previous
Next: Implementation issues Up: BATCHING: A Design Pattern Previous: The pattern applied to


Dynamics

When a program is received at the server side, it is deserialized. The interaction that follows is as shown in figure 5.

Figure 5: Interaction diagram for a cat program.
\begin{figure}
\epsfig{file=programinter.eps}\par\end{figure}

A BatchFileServer object at the server side is in charge of interpreting client programs. When its execute method is called, a program and a table of variables must be supplied. The execute method calls the run method of the program providing the table of variables; this method interprets the ``batch'' program. Once execute finishes results are returned.

The run method of the Program class implements recursive interpretation. When the program has been interpreted, that is, the run method has finished, results of the program execution are still in the variable table. As part of the execute method, the table is serialized and sent back to the client.

In our example, we can see6 the interaction diagram for a cat batch program in figure 5.

The run method of the Program calls the Run method of the ConcreteControlStructure representing the program (the WhileCtrlStruct in the interaction diagram). ControlStructures provide a Run method to interpret themselves. That is, a program has built-in its own interpreter; it is an instance of the INTERPRETER pattern [5]. So, the While command calls the Run method of its inner component (SeqCtrlStruct in the interaction diagram for cat).


next up previous
Next: Implementation issues Up: BATCHING: A Design Pattern Previous: The pattern applied to
Francisco J Ballesteros
1999-09-22