Chapter 8 Interaction View

zhaozj2021-02-16  46

8.1 Overview The interaction between objects reflects the behavior of the object. Such interactions can be described in two complementary ways, an independent object, and the other is carried out by a group of objects. The state machine is not wide, but it describes the deep-level behavior of the object, which is a "miniature" view of each object separately. The instructions for the state machine are precise and can be used directly for code. However, there is difficulties in understanding the entire function of the system, because the state machine only focuses on one object, and to determine the behavior of the entire system, it is necessary to simultaneously combine a plurality of state machines. The interactive view is more suitable for describing the overall behavior of a set of objects. The interaction view is a model of the relationship between the objects. 8.2 Collaboration Collaboration describes a set of objects in a certain context and interactions between these objects to achieve certain behaviors. It describes "object society" that cooperates with each other to achieve some purposes. There is a slot that is subject to the object and the connection in the work. Collaboration troughs are also called roles because it describes the purpose of objects or connections in collaboration. The class element represents a description of the objects involved in collaboration; the association role represents a description of the associations involved in collaboration execution. The class element character is a partial constraint in collaboration; the association role is associated with partial constraints in collaboration. The relationship between the collaboration between the class or the associated role is only meaningful in a particular context. Typically, the same relationship is not applicable to potential class and associations outside of collaboration. The static view describes the intrinsic intrinsic properties of the class. For example, Vehicle needs to have one owner. Collaborative diagrams describe the characteristics of class instances because it plays a special role in collaboration, for example, in a collaboration of RentalCar, RentalveHicle needs RentalDriver, which is usually related to the transportation that does not directly correlate but it is the basic part of collaboration. Objects in the system can participate in one or more collaboration. Although collaborative execution is connected by shared objects, the collaboration of the object does not have to be directly related. For example, in a Vacation model, someone can be both Rental Driver at the same time is HOTELEST. There is an unprecedented situation that an object may take multiple characters in the same collaboration. Cooperation includes two aspects of structure and behavior. Structural aspects are similar to static views - containing a role set and the relationship between them, which defines the content of behavior. Behavioral aspect is a message collection that delivers exchange between each object with a role. The message collection in collaboration is called interaction. A collaboration can contain one or more interactions, each interaction describes a series of messages, and the objects in collaboration are to exchange these messages in order to reach the target. The state of the state machine has a certain limit, but its description level is deeper, and the collaboration is not limited but the description is shallow. It captures the overall behavior of each other in the network structure of the object. Collaboration indicates the unity of the three main structures in the calculation process, namely, data structures, control flow, and data streams. 8.3 Interaction Interaction is a collection of messages in collaboration, which is swapped by the associated role by the class element role. When collaboration is running, an object being constrained by a class character is swapped by an associated role constraint. Interaction can be modeled to the operation, use case, or other behavior entity. The message is a single communication between two objects, from the sender to the recipient's control information stream. The message has the parameters used to pass the value of the object. The message can be a signal (a clear, named, an asynchronous communication) or call (synchronous call with the operation of the return control mechanism). Creating a new object is reached in the model, which is accepted by the creation of the object and is accepted by the class itself in the object. Create an event as a current event that is converted from the top-level initial state. Vasive for new instances. The message can be organized into sequential control threads. Separate threads represent several messages collection of concurrent. Synchronization between threads through the constraints of different threads. The synchronous structure is capable of modeling bifurcation control, combined control, and branch control. The message sequence can be represented by two diagrams: sequential diagram (time order of the message) and the collaboration map (the relationship between the object between the exchange messages).

8.4 Sequence diagram sequence diagram The interaction relationship is expressed as a two-dimensional figure. The longitudinal direction is a time axis, and the time extends downwardly. The horizontal axis represents the class elements of the independent objects in collaboration. The class is represented by the lifeline. When the object exists, the role is indicated by a dashed line that the lifeline is a double line when the process is in an active state. The message is represented with an arrow from the lifeline from an object to another object. The arrow is arranged from top to bottom in the figure in the figure. Figure 8-1 is a typical sequence diagram with asynchronous messages. Figure 8-1 Sequence Figure 8.5 Activation activation is the execution of the process, including the time waiting for the nested process. It is represented by partially replacing the two-way lines of the lifeline in the sequence diagram. The call is represented by an arrow pointing to the active activation caused by this call. When the control process re-enters one of the operations in the object, the recursive call occurs, but the second call is activated with the first call. The superposition of the recursive or nested calls in the same object is represented by the activation frame. Figure 8-2 is a sequence diagram containing a process control flow, including a recursive call, and an object creation. Active object is the root object in a set of activation objects in the activation stack. Each active object has its own event drive control thread, and the control thread is executed in parallel with other active objects. The object called by the active object is a passive object. They are only controlled when they are called, and the control is given up when they return. If several parallel control threads have their own process control flow, different threads must be identified in different thread names, colors, or other modes to avoid confusion when the two threads are in the same object. Typically, it is best not to mix using process calls and signals in a separate figure. Figure 8-2 Drawing Figure 8.6 Collaboration Figure 8.6 Collaboration Figure 8.2 is a class diagram, which contains the type element role and the associated role, not just a class and association. Cyrid roles and associated roles describe the configuration of the object and may appear when a collaborative instance is executed. When collaboration is instantiated, the object is limited to a class element role, and the connection is limited to the associated role. The associated role can also be taken by a variety of temporary connections, such as process parameters or partial process variables. Connection symbols can use the constructor to represent temporary connections ("parameter" or "local") or call the same object ("Self"). Although there may be other objects in the entire system, only objects involving collaboration will be expressed. In other words, the collaborative diagram only ignores other objects and associations on the related molds between objects and objects between each other, and ignore other objects and associations. Figure 8-3 is an interactive diagram. Figure 8-3 Collaboration Diagram can identify objects into four groups: objects existing in the interaction; objects created in interactions (using constraint {new}); destroyed objects in interaction (use constraint { DESTROYED}); created and destroyed objects in interactions (using constraint {Transient}). When designing, you can first indicate the objects and connections available at the start of the operation, and then determine how to control how the correct objects are implemented in the figure. Although collaboration directly shows the implementation of the operation, they can also represent the implementation of the entire class. In this use, it represents the context of all the operations of the class. This makes the object in different operations in different operations. This view can be constructed by describing the combination of the collaboration of all operations. 1. Message message can be represented by a tagged arrow attached to a link. Each message includes a sequence number, an optional frontal message table, an optional monitoring condition, a name, and a parameter table, an optional return value table. The sequence number includes the name of the thread (optional). All messages in the same thread are arranged in order. Unless there is an obvious order dependency, the news within the different threads is parallel. Details of various implementations will be added, such as the difference between step and asynchronous messages. 2. Flow usually, collaborate in a complete operation map contains symbols of the object. However, sometimes the object has a different state and must be expressed. For example, an object can change the location, or there is a difference between its associations at different times.

转载请注明原文地址:https://www.9cbs.com/read-25116.html

New Post(0)