Introduction to UML

xiaoxiao2021-03-20  230

(Connected to the previous period)

The main contents described in the top three periods are as follows:

First, standard modeling language UML overview

Second, the standard modeling language UML static modeling mechanism

Use example

2. Class diagram, object map and package

3. Component Diagram and Configuration Diagram Displays some features of the system implementation, including the static structure of the source code and the implementation structure of the runtime. The component chart shows the structure of the code itself, and the configuration diagram shows the structure of the system running time.

(1) The component map member diagram shows the dependencies between the software components. In general, the software component is an actual file, which can be a source code file, binary code file, and executable. It can be used to display the dependencies between compilation, link, or execution time. (2) Configure the graph configuration diagram Describe the physical topology of the system hardware and software executed on this structure. Configuration diagram can display the topology and communication paths of the calculation node, the software components that run on the node, the logical unit (objects, classes), etc. of the software components. Configuration diagrams are often used to help understand distributed systems. (3) Node and Joint Node (Node) represents a physical device and its software system, such as a UNIX host, a PC terminal, a printer, a sensor, and the like. As shown in Figure 1, "Client PC" and "Insurance Bed Server" are two nodes. The node is expressed as a cube, and the node name is placed in the upper left corner. The connection between the node represents an interactive communication path between the system, and is called a connection in UML (CONNECTIO N). The communication type is placed between "" "", indicating the communication protocol or network type used. (4) Components and interfaces In the configuration diagram, the component represents an executable physical code module, such as an executable program. It is logically corresponding to the package or class in the class diagram. Therefore, the distribution of each package or class in the node is displayed in the configuration diagram. As in Figure 1, the "Insurance Bed Server" node includes 3 components of "Insurance System", "Insurance Object Database" and "Insurance System Configuration". In an object-oriented method, elements such as classes and components are not all visible to all attributes and operations. They provide visible operations and properties, called the interface of the components. The interface can be expressed as a straight line of the small garden circle. In Figure 1, the "Insurance System" member provides a "configuration" interface. The dependency between the components is also shown, and the "Insurance System Configuration" component depends on this "configuration" interface. (5) Object (Object) A many objects can run in an object-oriented software system. Since the component can be considered as a physical code module corresponding to the package or class, some running objects should be included in the component. The objects in the configuration diagram are the same as the object representation in the object map. In Figure 1, the "Insurance System Configuration" component contains two objects of "Configuration Insurance Policies" and "Configure User".

Static modeling mechanism for standard modeling language UML is the basis for modeling UML. We believe that proficiency masters basic concepts, distinguishing different abstractions and flexible use in practice, is the basic principles of three most worthless.

Third, standard modeling language UML dynamic modeling mechanism

Message

In object-oriented techniques, the interaction between objects is done by the transmission of inter-object messages. This concept is used in the four dynamic models of UML. Typically, a message delivery is completed when an object calls an operation in another object. When the operation is executed, the control returns to the caller. Objects cooperate with each other, and constantly changing its own state based on the results of communication in their life cycle.

In UML, the graphical representation of the message is associated with the sender of the message with the arrow, and the type of arrow indicates the type of message, as shown in FIG.

There are three messages defined by UML:

Simple messages indicate a simple control flow. Used to describe how to pass during the object without considering the details of communication. Synchronous Message represents the nested control flow. The call is a typical synchronization message. After the caller issued a message, you must wait for the message to return, and only the caller can continue to perform its own operation only if the operation of the processing message is executed.

Asynchronous Message represents an asynchronous control flow. You can continue to perform your own operation without waiting for the message to return to the message. Asynchronous messages are mainly used to describe and release in real-time systems.

2. Status Diagram (state diagram) is used to describe all possible states of a particular object and events thereof caused by state transitions. Most object-oriented technologies use state diagrams to represent a single object in its life cycle. A state diagram includes a series of states and a shift between states. (1) All objects have a state in which the status is the result of a series of activities. When an event occurs, the status of the object will change. The state defined in the state diagram is: initiality, final state, intermediate state, composite state. Among them, the initiality is the starting point of the state map, and the final state is the end point of the status diagram. A state diagram can only have an initial state, and the final state can have multiple.

The intermediate state includes two areas: name fields and internal transfer domains, as shown in Figure 3. The internal transfer domain in the figure is optional, where the listed operation will be performed when the object is in this state, and the operation of the action does not change the state of the object.

One state can be further refined into a plurality of sub-states, and we will be able to further refine the state called a composite state. There are two relationships between "or relationships" and "relationships" between sub-states. Or relationship (Figure 4) illustrates only one sub-state at a certain moment. For example, a car in a driving state, in the composite state of "travel", two different sub-states in the back, and the car is either forward at a moment, or later. With the relationship (as shown in Figure 5), a plurality of sub-states (referred to as a concatenatic state) can be reached at the same time in a composite state. A state diagram having a concurrent sub-state is called a concurrent state diagram.

(2) The connection between the arrow between the state of the transfer state is called the transfer. The state of change is usually triggered by an event, and the event expression of the trigger transfer should be marked on the transfer. If the event is not indicated on the transfer, it means that the transfer is automatically triggered after the internal activity of the source state is completed.

3. Sequence diagram

The sequence diagram is used to describe the dynamic interaction between the objects, focusing on the time order of the inter-object messaging. There are two axes in the sequence diagram: the horizontal axis represents different objects, and the vertical axis represents time. The object in the sequence diagram is represented by a rectangular frame with a vertical dashed line, and is marked with an object name and class name. Vertical dashed lines are the lifeline of the object, which is used to indicate that the object is present within a certain period of time. Communication between objects is represented by drawing messages between the life of the object. The arrow of the message indicates the type of message.

The message in the sequence diagram can be a signal (Signal), an operation call, or a RPC (RemoteProce Dure Calls) in C , and RMI (Remote Method Invocation) in Java. When a message is received, the receiving object immediately starts an active activity, ie the object is activated. The activation is represented by displaying an elongated rectangular frame on the object line.

The message can be identified by the message name and parameters. The news can also be served, but less use. The message can also be provided with conditional expressions, indicating a branch, or deciding whether to send a message. If used to represent a branch, each branch is mutually exclusive, that is, only one message in the branch can be transmitted at a certain time.

In the left side of the sequential diagram, there may be explanation information, and the timing of the message transmission, the execution of the action, and the constraint information, and the like. A typical example is to illustrate a message being repeatedly sent. In addition, the time limit between the two messages can be defined.

An object can create another object by sending a message, which is identified by "X" when an object is deleted or self-deleted.

In addition, in many algorithms, recursion is a very important technique. When one operation is directly or indirectly called itself, recursive occurs. Generating recursive messages always synchronize messages, and return messages should be a simple message.

4. Cooperation map

Collaboration Diagram is used to describe interaction relationships and link relationships between objects that cooperate. Although sequential diagrams and collaborators are used to describe the interaction between the objects, the side focus is different. The sequence diagram focuses on the time order of interaction, and the cooperation map focuses on the static link relationship between interactive objects.

The appearance of the object in the cooperation map is the same as the sequence diagram. If an object is created in the interaction of the message, you can mark {new} after the object name. Similarly, if an object is deleted during interaction, you can labeled {design} after the object name. Link relationship between objects is similar to the contact in the class map (but there is no multi-weight flag). By marking messages with a message string (simple, asynchronous or synchronous messages) on the link between the objects (simple, asynchronous, or synchronous messages).

(1) Link link to represent various relationships between objects, including constituting linkages, links for aggregation links, Limited Links, Navigation Link, Navigation Link . Various link relationships are the same as the definition in the class diagram, and the role name and template information of the object can be displayed in the link of the endpoint position. (2) The message stream is on the link line of the cooperation graph, and the interaction between the object can be described with a message with a message string. The arrow of the message indicates the flow direction of the message. The message string illustrates information such as the message, the parameters of the message to be sent, and the return value of the message, and the serial number of the message (endless).

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

New Post(0)