txt
In practice, we rarely write an FSM model program, we just write an FSM text
file instead. When you invoke a tool with the /fsm option, it reads the FSM from
the file and constructs a FsmModelProgram instance in much same way as shown in
Figure 7.12. The tools do require you to write a factory method for library model
programs (rather than just invoking the constructor automatically) because this is
where you identify the features you want to include.
The tools do not depend on the source form of model programs. They access every
model program in a uniform way through an instance of the ModelProgram class,
which always provides certain properties and methods, including InitialState,
GetActions, GetTargetState, and so on. (Chapter 6, Section 6.2.4). As a result,
every style of model program can be composed, explored, viewed, and used for
testing in the same way. From the tools??™ point of view, the differences between
model program styles are hidden by derived types such as LibraryModelProgram and
FsmModelProgram. It is possible to support model programs written in other styles
and languages by coding additional types derived from ModelProgram. For example,
you could support model programs that are expressed as diagrams rather than text.
7.3.3 Scenario model programs
Now that we understand composition and know how to write scenario model programs
easily, we are ready to use composition for scenario control.
Pages:
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192