Communication controlentity

Another point of communication that needs to be studied carefully is the communication between the control and entity objects. In the class diagram for the Kraalingen approach, the relationships between control and entity classes are modeled as a composition. The control class, SimulationControiler, plays the role of the whole; entity classes, such as Plant, Soil and Weather, play the role of parts. The whole has access to data and behavior of the parts but not vice versa. Objects of the SimulationController class have access to entity objects because of the attributes plant, soil, and weather that hold a reference to the corresponding entity objects, as shown in Figure 8-22. This figure presents the Java code for class definition of SimulationController modeled as a Singleton and defined in the UML diagram shown in Figure 8-18.

Lines 6, 7, and 8 define attributes of types Plant, Soil, and Weather to hold references to the corresponding objects. As we see, the control object is directly connected to the entity objects.

1 final class SimulationController {

0 0

Post a comment