UML model diagram
The UML model map can represent a portion of a part of a certain aspect of the modeling system in a graphic manner, and different views can describe the characteristics of a system model by combining a plurality of different model map organic combining a plurality of different model maps. . The model of UML is a model element, and the model element is intuitive in the form of an icon in the form of an intuitive image. Some model elements can be used in a plurality of model figures, such as annotations and comment connections, can be used in any model diagram for comments to other model elements. The collection of model elements that can be used in various model maps is also different, and there will be specific descriptions when introducing various model diagrams.
UML defines nine models: Use case (Case Diagram Diagram), Object Diagram, Component Diagram, Deployment Diagram, Statechart Diagram (STATECHART DIAGRAM) , Activity Diagram, Sequence Diagram, and Collaboration Diagram. The nine models also have focused on the user's needs, such as the use of examples, and the class map focused describes the specific implementation of the system; the aspects of the description are different, as described in the class, the structure of the system, the sequence diagram is the behavior of the system. The abstract level is also different, such as component diagram depicting the module structure of the system, the abstract hierarchy, the class diagram is the structure of the specific module, the abstraction level is generally, the object map describes the specific module implementation, the abstract hierarchy is low.
In some literature books, this nine model graph is divided into three major categories: structural classification, dynamic behavior and model management, structure classification includes examples, class diagrams, object pictograms, components and deployment diagrams, dynamic behavior include status Figure, active diagram, sequence diagram, and collaboration map, model management contains class diagrams. This article describes the nine model diagrams of UML from dynamic and static angles.
2. Static model diagram
The structure classification model diagram describes the system's and time-related properties and behaviors. Static model diagrams include class diagrams, object maps, components and deployment diagrams.
2.1 class diagram
The class diagram describes the interrelationship between classes and classes. The class is represented by a rectangle in the UML. There are three regions in the rectangle, the uppermost area is the name domain, used to display the class name, the middle area is the attribute domain, used to display the attribute list of the class, the bottom The area is the operating area, display the defined operation list, as shown
2.2.1
Indicated.
Figure
2.2.1
Class representation
Figure
2.2.1
In the present, the property you also contain attributes, such as name, type, visibility, etc., the name of the property is the name of the identity attribute. The type of property is the data type belonging to the property. It is the visibility identifier attribute to be outside the class. The class is directly accessed, and the attribute visibility is divided into three: public, protected and private. The PUBLIC logo is that the corresponding attribute can be directly accessed by the class and other classes; the protected identity is access to the corresponding attributes can be accessed by a series of classes related to the class, and the relevant object-oriented programming language is different. The definition, the protected is identified by the property that the property can be inherited in the PUBLIC mode. In Java, the identity property can be accessed by all classes of the package (PRIVATE identifier) Can be accessed by the class. The attributes of the operation include name, return type, parameter type, and visibility, etc., the name is the name of the operation; the return type is the type of return value; the parameter type is the parameter type of the incoming operation; the visibility identifier is whether the operation can Direct access from class beings outside the class, also divided into: public, protected, and private. Sometimes, in order to express the simplicity, you can save the various properties and operations of the class. Interrelation between classes includes: association, dependency, generalization, and realize.
The association describes the logical relationship between the objects of the class, which may be similar, or may not, both ends of the association are referred to as roles, such as the customer and the order. Association. There are three main forms in the UML, one is the two-way association with a line segment identifier, called association; the second is a unidirecting association with a line segment with an arrow; It is a rhombus to indicate the class of the associated ends of the associated ends is the overall and part of the relationship, which is also called aggregation, for example: an object A contains a reference to another object B, one end of the diamond The object A is connected to the object B. The polymerization is divided into. Figure
2.2.2
The three associated graphical representations are shown.
Figure
2.2.2
Three associations
D
2.2.2
It can be seen that both the association between NewClass2 and NewClass4 has an asterisk, which is a multiplex for identifying the role of the associated role, such as one-to-one, one-to-many, multi-to-many, here, what is identified is newclass2 and Newclass4 is multi-related.
Relying on the dependencies between model elements, depending on the model elements at both ends of the relationship, one end is independent and the other end needs to rely on this independent element. The dependency is represented by a dotted segment with an arrow.
Generalization is expressed as an abstraction and specific relationship between the model elements, that is, the inheritance relationship between the model elements. The successor has the same characteristics as the successor, but also can expand on the basis of the successor, such as: people and Chinese relationships are generalization relationships, Chinese people are people, and they have human characteristics, and they have their own expansion The characteristics. In the object-oriented object, the successor is called a parent class, and the successor is called subclasses. Using a line segment with hollow triangle arrows, the triangle arrow points to the parent class, the other end is connected to the subclass.
Implementation relationship indicates that a model element implements an operation of another model element definition, which is generally referring to a method that implements an interface-defined method. In the object-oriented concept, the interface is only defined method, does not implement this method. To inherit it to other classes, and implement it to define methods with the operation of classes. The definition and abstraction can be separated, and it is possible to maintain the maintenance of the code. Implementation relationship is expressed in a dotted segment with a hollow triangle arrow, and the triangular interface points to the interface, and the other end of the dashed section is connected to implement the class. In addition to the above, UML also provides another simple representation, indicating an interface with a circle, there is no interface definition, by connecting it with a single class, Indicates the relationship between the interface and implementation.
The generalization and realization relationships are described in general and specific relationships, but there are still differences: generalization of the general and specific relationships of the same abstraction level, and implementation is the general and specific relationships of different abstractions. The abstract level of the interface is higher.
2.2 object map
The object map describes the relationship between objects, or it is understood as an image of the system at a certain time. The object map is described above in comparison, such as how the objects describing the individual classes of a system are combined. Object diagrams are so complicated. The object's representations and classes are similar, just in the name domain to indicate the name and class name, the two are separated by colon, the attribute domain to identify the specific value of the attribute, and the relationship between the object is Connected with a solid segment. There are rarely drawn from the object map, some Case tools, such as Rational Rose 2002, no object maps. The concept of objects is more use in dynamic model diagrams.
2.3 components
The component diagram depicts the dependencies between the components and components in the system, and the component diagram is a physical structure of the system in a very specific level.
The component shows a few major model elements: components, interfaces, dependencies. The component is to define a good interface implementation code unit, which has become part of the system. The component does not rely on other components, depending on the interface thereof, and therefore, the component is alternative, as long as the new replacement member supports the same interface, the component has two small rectangular large rectangles with one left side. Representation; the interface is used to describe the interface defined by the component, which is represented by a circle, which is connected to the solid segment; the dependency describes the dependencies between the members, indicated by the dotted segment with arrows, and the arrow is called Relying on the component.
2.4 deployment map
The deployment diagram describes any physical or logical configuration based on a computer-based application. It can describe the physical topology of the system hardware and system software executed on this structure, and also describe the topology and communication paths of the system node, the components running on the node, and logic units in the component.
There are several major model elements in the deployment diagram: nodes, components, objects, interfaces, connection, dependencies. A node describes a physical device and a software system running, represented by a cube. Connection is the communication path between the nodes and is represented by a solid segment. The components, objects, interfaces, and dependencies are the same as before.
3. Dynamic model diagram
The dynamic behavior model diagram describes the behavior of the system over time. Dynamic model diagrams include: use case diagrams, state diagrams, active diagrams, sequence diagrams, and collaboration diagrams.
3.1
Use case
Use an example to describe the behavior and characteristics of the system from the user's perspective. The use case is generally a tool for the need to analyze the system.
The first thing to be clear in the example is the use case. The use case is a functional unit of the system describing a interaction behavior that participants and systems. For example: Bank's ATM ATM system, user withdrawal is a use case.
With examples, there are several model elements: Use case, participant (actor), association, including relationship, extended relationship, and generization. The use case is indicated by an ellipse. The ellipse center is the name of the use case; the participant is an external user, process or other system interacting with the system to model, and the participant is represented by a human icon; the association relationship describes the participant There is a communication path between the use cases that need to interact, expressed in a solid segment; including the relationship, a use case is used to complete a process with another use, with a dotted segment with an arrow and "Include" as "Include" The logo is indicated that the arrow points to the use case included; the extension relationship describes that the use case is based on the original use case, which extends the part of the use case, and the relationship is similar, but also in a dashed segment with an arrow, different What is shown on the dashed segment is "" extend "", the arrow points to the extension of the extension; the general and special relationships between the generalization relationship description, the special use case is based on the characteristics of the general use case. Added The new features, generalization relationships, and extension relationships are similar, and different is the need to expand the extension points of the expanded use case. The extension can only expand these extensions, and the generalization relationship is used with a hollow triangle arrow. The solid segment is represented. 3.2
State diagram
The state diagram describes the object, the subsystem, and the system, the system, the system, and the various behaviors in the life cycle, simply that a state diagram only describes the behavior of an object (can be class, program module, system). By the state diagram, you can know the various status of an object, subsystem, and system, and the influence of the message thereof on its state. Everything in the world can be described, so they can describe their behavior through a state diagram, and the status map has strong expression.
The status diagram has the following common model elements: State, Transition, Start State, Termination Status (End State). The state describes the feature of a period of time in the life cycle of an object. The state is a rectangular shape with a rounded corner; the transfer describes the transfer of the state, indicates the solid segment with an arrow, and it is also possible to add a label to the conversion. Describe the events, conditions, and operations to be executed, the label format is: event name [condition] / operation, each part of the label can be omitted; the starting status describes the beginning of the life cycle of the object, with a black color The circle is indicated, sometimes in order to express it, without the confusion concept, the start state can be omitted; the termination state describes the termination stage of the life cycle, indicated by a black circle with a circular frame, one state map There can be multiple termination states, sometimes in order to express it, the termination state can be omitted without confusing concept.
3.3
Activity map
The active diagram is the behavior of the object through a series of activities, the object can be a program, module, subsystem, system. Through the active map, you can learn about the various tasks and processes to be performed.
The model elements commonly used by the activity map include: Activity, Start, Terminal, Transition, Object, Synchronization, Synchronization Bar, Information Flow Swinlane. The activity describes a task or one of the system to be done. It is an atomic activity in the activity diagram. The activity is represented by a rectangular rectangle of a rounded corner; the active name; the starting point describes the start state of the active map, Similar to the status map, with a black circular identification, the active map can have multiple start points; the termination point describes the termination state of the activity map, similar to the status map, indicated with a circle, and there are multiple Term point; conversion description activity between activities, that is, the control stream of the object, the conversion is indicated by the solid segment of the arrow, the arrow points to the steering, can be converted on the conversion of text identity; object is activity The object participated in the figure, it can send a signal to the active or receive the active signal, or the input / output result of the active input / output, the representation of the object is the same; the condition determination describes the branch of the activity between the activity between the activity, only An influent information flow, the information flows output under different conditions have different flows, and the condition determination is expressed in a rhombus; the synchronization strip describes synchronization between the activity, and generally there are multiple information flow flow, multiple information flows, must It is an inflow information flow to reach, and the flow of information flows can simultaneously flows at the same time, and the synchronization strips are represented by a thicker level or vertical solid segment; the information flow description activity and the interaction of the object, the object can be used as an active input / Output, can also be used as an entity, a transmitted signal, or a dashed segment of the information flow with arrows to the active transmission signal, and the arrow identifies the direction of the information flow; the lane description is a packet in the activity map, usually, According to a certain standard group, the lane in the UML activity chart is to divide the activity map out of the horizontal direction, and the group of activities and objects are separated by dashed between the locations in this area. 3.4
Flowchart
The sequence diagram expresss the behavior of the described object by describing interaction between objects. The sequential graph emphasizes the time sequence of the object interaction. The model map described above can be different from the model element. The sequence diagram has a certain structure, and the sequence diagram can be seen as a two-dimensional coordinate, and the vertical direction is different objects, and the horizontal is the order.
Sequence diagrams common model elements are: objects (Object) and messages (MESSAGE). The object is a sub-object in the object described in the sequence diagram, and the object representation and the object map are similar, but the object in the sequence diagram is placed only on the top end of the longitudinal region where the object is located, and there is a broken line extending downward. Represents the life line of the object, in the area where the action is acting (such as sending a message to other objects), the dashed line of the lifeline is replaced by a rectangular block, and it is used to indicate that the object is active in the active state, and one "×" in the end of the object life line The end of the object life; the message is the information of the inter-object communication, which can be control information, data information, etc., the message can be divided into simple messages, synchronization messages, asynchronous messages, and returns messages, simple messages identify the general news between the objects, no The specific details, only one communication between the objects, the simple message indicates a solid segment with an arrow, and the synchronization message describes the message's sender sends a message, and must receive a reply message to perform subsequent actions, synchronize The message is indicated by a solid segment with a solid triangle arrow. The asynchronous message is described by the message's sender to perform subsequent actions after sending a message. No need to wait for the reply message, and return the message description is the action from the synchronization message. The message of the synchronization message sender, the return message is represented by a dotted segment with an arrow. 3.5 Collaboration Map
Collaborative diagrams describe a set of objects in a certain context and the relationship between interactions between objects to implement certain functions and objects. The collaborative figure can be seen as a subject map, and the message communication between the objects is added to describe the interaction between the objects. Unlike the sequence diagram, the collaborative focus is to describe the interaction of the object on the space.
In addition to the model elements of the object map, the collaboration map is added to the message (Message), the message is the communication between the objects, thereby implementing the interaction of the object, and the message can be divided into: a simple message pointing to the source, pointing to the simple message , Pointing to the asynchronous message, pointing to the asynchronous message of the purpose, pointing to the source synchronization message, pointing to the synchronization message of the purpose, pointing to the source and pointing purposes to represent the flow direction of the simple message, just the point of graphics, pointing to the source. The message and the simple message pointing to the purpose are indicated by a line segment with an arrow. The simple message pointing to the source only points to the left side, the simple message pointing to the purpose is only to the right, pointing to the source of the asynchronous message with the second half of the solid segment The asynchronous message pointing to the purpose is represented by a solid segment with the upper half arrow, and the synchronization message of the source is indicated by the source of the source, indicating the solid segment of the solid triangle arrow, pointing to the source of the source only points to the left side, pointing to the purpose The synchronization message is only directed to the right. http://mxlee.52blog.net