UML is a general modeling language, its expressive ability is quite strong, not only can be used in software system modeling, but also can be used for business modeling and other non-software system modeling. UML synthesizes The advantages of various object-oriented methods and representations, and has received extensive attention and support from the industry since the date of presentation.
This chapter introduces the construction and basic elements of UML in turn, by view, model elements, graphs, and public mechanisms, so that the reader has a general understanding of UML, and the details of which are described in detail in subsequent chapters.
Drawing tools: Edraw, Jude
You are welcome to continue to support and follow my blog:
Http://hoojo.cnblogs.com
Http://blog.csdn.net/IBM_hoojo
You are also welcome to communicate with me and explore the knowledge of it.
Email:[email protected]
If you think this article is good, please click on the bottom right of the screen. If you later use this article or feel that you want to re-read it later, you can click on the bottom right corner of the screen. If you think my blog is good or if you want to see my news in the first place, you can click on the bottom right corner of the screen. If you want to say something, you can click on the bottom right of the screen. If you've ordered it, it's really very nice of you, brother. At this point, perhaps you can click on the button and then look at the navigation of the blog to continue browsing other articles.
1. The composition of UML
UML consists of several parts, such as view, figure (Diagram), model element, and general mechanism.
A) View: A subset of UML modeling elements that express the characteristics of a particular aspect of the system, consisting of multiple graphs, which is an abstract representation of the system at an abstraction level.
b) Figure (Diagram): is a graphical representation of the set of model elements, usually composed of arcs (relationships) and vertices (other model elements) connected to each other.
c) Model element: Represents the concepts of classes, objects, messages, and relationships in object-oriented objects, and is the most basic common concept for composing diagrams.
D) General mechanism: used to represent other information, such as annotations, semantics of model elements, and so on. In addition, UML provides an extension mechanism that enables the UML language to adapt to a particular method (or process), or to an organization or user.
2. Classification of UML views
UML is a model used to describe a system's mechanism or static characteristics, as well as behavior or dynamic characteristics. The system architecture is modeled from different perspectives to form different views of the system.
(1) The Use Case view , which emphasizes the system functions seen or required from the user's perspective, is a model diagram of the system functionality that is known to the external user of the participant.
(2) A logical view (Logical view) that represents the static or structural composition and characteristics of a system, also known as a structural model view (Structural models view) or a static view.
(3) The Concurrency View (Concurrent view), which embodies the dynamic or behavioral characteristics of a system, is also known as a behavioral model view (behavioral Model view) or dynamic view.
(4) Component View (Component view), which embodies the structure and behavior characteristics of the system implementation, also known as the Implementation Model view (Implementation mode view).
(5) configuration View (Deployment view) embodies the structure and behavioral characteristics of the system implementation environment, also known as the Environment Model view (Environment models view) or the physical view (physical view).
views are made up of graphs of, UML provide 9 different kinds of graphs:
(1) Use case Diagram, describe the function of the system;
(2) class diagram (class Diagram), describing the static structure of the system;
(3) object graph (Diagram), which describes the static structure of the system at a certain time;
(4) Component diagram (Component Diagram), which describes the organization of the elements that implement the system;
(5) configuration diagram (Deployment Diagram), which describes the configuration of the environment elements and maps the elements of the implementation system to the configuration;
(6) State Diagram, which describes the state condition and response of the system elements;
(7) Time series diagram (Sequence Diagram), which describes the interaction between system elements in chronological order;
(8) Collaboration diagram (collaboration Diagram), which describes the interaction between system elements and their relationships in the order of time and space;
(9) Activity Diagram, which describes the activities of the system elements;
The modeling method is composed of two parts: Modeling Language and modeling process . The modeling language is used to express the method of design, and the modeling process is a description of the steps to be taken in the design. UML is a modeling language that is largely independent of the modeling process. In actual modeling, it is best for modelers to use UML in a case-driven, system-centric, iterative, and incremental development process.
Generally speaking, the architecture of software system gives the information such as the organization of software system, the structure element of composing system, the choice of its interface, the behavior of system and the architecture style. In other words, it not only cares about the functional requirements of the structure and behavior of the system, but also the non-functional requirements such as the performance of the system, ease of understanding and reusability. As shown, UML uses user model views, structural model views, behavioral model views, implementation model views, and environment model views to describe the architecture of a software system.
depending on their application in different architectural views, it is possible to 9 The types of graphs are divided into:
(1) User Model view: use case diagram;
(2) Structure Model view: Class Diagram and object;
(3) Behavioral model views: State, time series, collaboration and activity diagrams (dynamic graphs);
(4) Realization Model view: Component diagram;
(5) Environment Model view: Configuration diagram.
The User Model View consists of a case that describes the system behavior seen by end users, analysts, and testers, and it actually describes the functionality that the system should have from the user's perspective . The system functionality described in the user Model view relies on an external user or another system to activate, to provide services to the user or another system, thereby enabling the user or another system to interact with the system. The ultimate goal of the system implementation is to provide the functionality described in the User model view. In UML, the user model view is made up of the use case diagram .
The Structure Model view describes the static structures of the classes, objects, and relationships that comprise the system to support the functional requirements of the system, which describes how the system's internal functions are designed. The structure model view is made up of class diagrams and object diagrams , which are used primarily by designers and developers .
The behavioral Model view is mainly used to describe the threads and processes that form the system concurrency and synchronization mechanisms , and its focus is on non-functional requirements such as system performance, scalability, and system throughput. The Behavior model View leverages concurrency to describe the efficient use of resources, parallel execution, and processing of asynchronous events. In addition to the control threads that the system divides into concurrent execution, the behavior model must also deal with communication and synchronization issues between these threads and processes. The Behavior model view is primarily used by system developers and system integrators , and consists of sequence diagrams, collaboration diagrams, State diagrams, and activity diagrams .
The implementation Model view is used to describe the dependencies between the implementation modules of the system and the allocation of resources. This view is mainly used for the configuration management of the system, which is composed of some independent components. The implementation model view is made up of component diagrams . The components are code modules, and different types of code modules form different components. The implementation model view is primarily intended for use by developers .
The Environment Model view is used to describe the hardware topology of a physical system. For example, the distribution of computers and devices in a system and how they are connected, where computers and devices are collectively referred to as nodes. In UML, the Environment Model view is represented by a deployment diagram. The system deployment diagram describes the distribution of the system components on the nodes, that is, the mappings that describe the software artifacts to the physical nodes. Deployment diagrams are intended for use by developers, system integrators, and testers .
Each of these views reflects a specific aspect of the system, and each individual can use each of these views individually to focus on specific architectural issues. In general, however, because the ultimate goal of the system is to provide the functionality described in the user Model view, as well as other non-functional requirements, the user model view is the core foundation of the other views, and the other views are constructed to depend on the class capacity described in the user model view.
Careful readers have found that each UML diagram is made up of multiple diagrams, each of which is a representation of one side of the architecture, and the graphs are actually consistent, and all the graphs together form a complete view of the system. As shown, the UML provides a total of 9 diagrams of diagram, Class diagram, object graph, sequence diagram, collaboration diagram, State diagram, activity diagram, build diagram and deployment figure. Depending on whether they describe the static or dynamic behavior of the system, they can be divided into static and dynamic graphs. To further introduce these 9 UML diagrams, let's look at what the model elements are:
3. UML 's modeling mechanism
UML has two sets of modeling mechanism: Static modeling mechanism and dynamic modeling mechanism. Static modeling mechanisms include use case diagrams, class diagrams, Object graphs, packages, component diagrams, and configuration diagrams. The dynamic modeling mechanism includes the state diagram, time series diagram, collaboration diagram and activity diagram.
(1) Use case diagram: A visual tool for use cases, which provides a high-level user view of a computer system, indicating how it will be used in the perspective of an external activity.
Use case diagrams (use cases) are used to describe a set of cases, participants, and their connection relationships. A diagram depicts a set of sequence of actions, each of which represents the interaction of the system's external facilities (the system's participants) with the system itself. From the point of view of a particular participant, a case is done to work that is valuable to him. As shown in 2.5, the diagram simply describes the information in the system from the perspective of the participant using the system, that is, standing outside the system to see what the system should be capable of, without describing how the function is implemented within the software. The case can be applied to the whole system, or it can be applied to a part of the system, including subsystems, individual classes or interfaces. In general, the case not only represents the desired behavior of these elements, but can also be used as the basis for the test case in the development process.
The use case diagram includes the following 3 aspects:
(a) Use cases
(b) Participant (actor)
(c) dependency, generalization and association
Example use case diagram:
(2) class diagram: Diagrams that describe classes, interfaces, collaborations, and relationships between them.
Class diagrams are used to describe a set of classes, interfaces, collaborations, and the static relationships between them. In the modeling of object-oriented system, class diagram is the most common diagram, which is used to clarify the static structure of the system. In fact, a class is a description of a set of objects with the same attributes, operations, relationships, and semantics, and one of the most important details when describing the properties and operations of a class is its visibility.
Classes can be connected in many forms, such as associations, generalizations, dependencies, and implementations. Typically there are several class diagrams in a typical system. A class diagram does not necessarily include all the classes in the system, and a class can be added to several class diagrams.
Class Diagram Example:
(3) Object graph: A diagram that represents a set of objects at a certain time and the relationship between them. An object graph can be seen as an instance of a class diagram at some point in the system.
An object graph is an instance of a class diagram used to describe the relationship between a set of objects at a particular run time. That is, the object is used to describe the static part of the interaction, which consists of the objects involved in the collaboration. But does not include any messages that are passed between objects.
When you create an object graph, the modeler does not need to use a single object graph to describe each object in the system. In fact, most systems contain hundreds or thousands of objects. It is generally unrealistic to use objects to describe all the objects of the system and the relationships between them. As a result, the modeler can choose the relationship between the objects of interest that are extremely interesting to describe.
The symbols used in the object graph and the symbols used in the class diagram are almost identical, except that the object name of the object graph is underlined, and all instances of the relationship between the class and the class are drawn.
(4) Component diagram: Describes the relationship between software components and components, which are the physical modules of the code, and the component diagram shows the structure of the code.
Component diagrams (component diagrams) are static implementation views used to describe the organization and dependencies between a set of artifacts for modeling systems. Artifacts can be executable assemblies, libraries, tables, files, and documents, which contain implementation information for logical classes or logical classes, so there is a mapping between the structure model view and the implementation model view.
A build diagram can also include packages or subsystems, which are used to make a large chunk of the model elements.
Component Legend Diagram:
(5) Configuration diagram: Describes the physical topology of the system hardware and the software executed on this structure. The configuration diagram shows the topology and communication path of the compute nodes, the software components running on the node, the logical units (objects, classes) contained in the software components, and so on. Configuration diagrams are often used to help understand distributed systems.
A configuration diagram (deployment diagram) is used to describe the configuration of the nodes on which the system runs and the artifacts that are active on the nodes. The deployment diagram is used to model the system's environment models view. In most cases, the deployment diagram is used to describe the amplification structure of the system hardware.
In UML, the modeler can use the class diagram to describe the static structure of the system, the dynamic behavior of the system can be described by sequence diagram, collaboration diagram, State diagram and activity diagram, and the deployment diagram is used to describe the topology of the processor and device that the software executes.
(6) State diagram: A model is established through the life cycle of a class object to describe the dynamic behavior of an object over time.
A state diagram is actually a state machine composed of States, transitions, events, and activities. A state diagram describes a control flow from state to state, often used for modeling dynamic properties of a system. In most cases, it is used to model the behavior of reactive objects.
In UML, a state diagram can be used to model the behavior of an object by event ordering. A state diagram is a simple representation of the state machine that emphasizes the control flow from state to state. In general, a state diagram is a supplemental description of the facility described by the class, which describes the possible state of all the objects of the class and the events that cause the state to change.
(7) Time series diagram: An interaction diagram describes an interaction that consists of a set of objects and their relationships, and also includes information passed between objects. Interaction between objects is a modeling tool that describes how a group of objects can work together to complete a behavior.
Sequence diagrams and collaboration diagrams are collectively referred to as interaction diagrams. The sequence diagram is used to describe the order in which messages are sent between objects, to clarify the interaction between objects and what happens at a specific point in the execution of the system. A sequence diagram is an interaction diagram that emphasizes the chronological order in which objects are arranged along the horizontal axis and messages are arranged in the longitudinal direction.
The object lifeline in a sequence diagram is a vertical dashed line that indicates that an object exists for a period of time. Because most of the objects in a sequence diagram exist throughout the interaction, the objects are all arranged at the top of the graph, and their lifelines are drawn from the top of the graph to the bottom of the graph. Underneath each object is a rectangular bar that overlaps with the object's lifeline, which represents the object's control focus. Messages in a sequence diagram can have ordinal numbers, but because the messages on this graph have been sorted chronologically from the vertical axis, the message ordinals are usually omitted.
(8) Collaboration diagram: Contains the class meta roles and associated roles, not just the classes and associations. The collaboration diagram emphasizes the organization of the objects participating in the interaction. Collaboration diagrams model only the interactions between objects and the relationships between those objects, ignoring other objects and associations. A collaboration diagram is also an interaction diagram that emphasizes the organizational structure of the objects that send and receive messages.
collaboration diagrams and sequence diagrams are collaborative, and they can be converted to each other. In most cases, a collaboration diagram primarily models a monotonous, sequential flow of control, but it can also be used to model complex control flows, including iterations and branches.
In general, Modelers can create multiple collaboration diagrams, some of which are primary, and others are selectable paths or exception conditions. Modelers can organize these collaboration diagrams with packages and give each diagram an appropriate name to differentiate it from other diagrams.
(9) Activity diagram: An activity or action used to show a class that participates in a behavior.
An activity diagram is a special case of a state diagram in which almost all or most of the states are active, and almost all or most of the changes are triggered by the completion of activity in the source state. An activity diagram is essentially a flowchart that describes the flow of control from activity to activity.
The activity diagram can be thought of as a new kind of interaction diagram, but the interaction graph observes the object that transmits the message, and the activity diagram observes the message that is transmitted between the objects. Although the semantic differences between the two are subtle, they look at the system in different ways.
The composition of the uml-uml of software design [top]