Control classes

Control classes are used to model the behavior that is required for the realization of one or more use cases. Thus, a control class should provide the behavior that expresses the realization logic of a use case; therefore, they are use case specific. If the logic of a use case changes, then the behavior of the corresponding control classes should be adjusted accordingly. Figure 8-12 shows the UML symbols for a control class; each of them can be used interchangeably.

Simulator

Figure 8-12. UML symbols for a control class.

Objects created from control classes (i.e., control objects) are used to control or coordinate the behavior of other objects. Control objects supervise the flow of events in a use case realization. The lifecycle of a control object is linked to the lifecycle of the corresponding use case. A control object is created when the use case is performed and usually it dies when the use case is terminated. A control object may be used for the realization of one or more use cases. In the case that a use case is complex, many control objects created from different control classes can collaborate to control the use case. The number of control objects that are needed to control a use case is not easily determined. Many factors, such as the designer's experience and the flexibility of the system under construction, can impact the number of control classes that need to be created.

As control classes are closely related to the realization of a use case, they belong to the internal part of the system. Therefore, control classes do not interact with actors; an actor should not communicate directly with a control class. Unlike boundary classes, control classes are platform independent; the same control class can play its role in different computing platforms.

In section 4.1, Conceptual model for Kraalingen approach, it is mentioned that classes Plant, Soil, and Weather will provide the necessary data needed in the simulation process. Objects created from these classes will send messages to one another to obtain data located in one object that are required in another object. A controller object is needed to coordinate the interaction amongst objects. Figure 8-13 shows an example of a control class used to control the flow of events in the Start Simulation use case.

Simulator

Figure 8-13. SimulationController controls the flow of events for the use case.
0 0

Post a comment