Key Points of UML modeling (1)

Source: Internet
Author: User

In the previous article "Top Ten elements of RUP", I introduced some elements of RUP. At the beginning of this article, I will go into the details of UML.

Prerequisites:

I. characteristics and development status of UML

UML is a Language)
UML is a Modeling Language.
UML is a Unified Modeling Language.

1. Fact standards that have entered the full application stage
2. Application fields are gradually expanding, including embedded system modeling, business modeling, process modeling, and other fields
3. become an important supporting technology for "Generative programming": MDA, executable UML, etc.

Ii. Objectives and Principles of Modeling

1. Help us visualize the system based on the actual situation or the style we need; provide a method to describe the structure or behavior of the system in detail; provide a template to guide the system construction; document our decisions.
2. Build a model only when it is needed.
3. Selecting the model to be created has a profound impact on how to solve the problem and how to form a solution. Each model can be expressed at different precision levels; the best model is associated with reality; a single model is inadequate. It is best to process each important system with a set of nearly independent models.

3. Who should model

1. Business Modeling: Mainly engaged by field experts. Requirement Analysis personnel are the main force. system analysts and architects can participate.
2. requirement model: mainly needs analysts, system analysts are the main force, field experts provide guidance, and architects and senior developers participate
3. Design Model: The high-level design model focuses on architects. The system analyst provides support in terms of requirements, and senior developers provide support in terms of technical implementation. The detailed design model is dominated by senior developers, and the architect provides guidance.
4. Implementation Model: Senior developers (designers) are the main components, and architects provide overall guidance.
5. database model: Mainly used by database developers, architects provide guidance, and senior developers (designers) cooperate.

Official start

UML is composed of three parts (Construction blocks, rules, and public mechanisms). The relationship is shown in:

I. Construct Blocks
1. constructor blocks are the abstraction of the most representative components in the model.
Modeling element: a term in UML, which is a basic physical element of a model.
Behavior element: a verb in UML. It is a dynamic part of the model and a behavior that spans time and space.
Group Elements: containers in UML are used to organize models and make the models more structured.
Annotation element: the interpretation part in UML is used to describe the model like the annotation statement in the code.

1.1. Modeling Elements

Class and object)
Interface)
Active class)
Use case)
Collaboration)
Component (component)
Node)

Class and object)

Class is the abstraction of a group of objects with the same attributes, the same operations, the same relationship, and the same semantics.
In UML, a class is represented by a rectangle. It contains three areas: the class name at the top, the class attribute in the middle, and the class method at the bottom.
An object is an Instance of Class)

Interface)
An interface is a service operation set that describes a class or component.

Active class)
Active classes are actually special classes. The reason for referencing it is actually that some classes are required in development to start the control activity.
An active class is a class in which its object has at least one process or thread and can start control activities.

Use case)
The use case was first proposed by the famous master Ivar jacbson and has become the most common tool for Demand Analysis in object-oriented software development.
Use Case instances are a series of actions executed in the system. These actions generate value results visible to specific executors. A Use Case defines a group of use case instances.

Collaboration)
Collaboration defines an interaction. It is a group of roles and other elements that work together to provide a cooperative action.
The implementation of a use case can be expressed as a collaboration

Component (component)
In actual software systems, there are many entities that are larger than "classes", such as a COM component, a DLL file, a JavaBeans, and an execution file. Components (also translated as components) are introduced to better represent them in the UML model)
A component is a modular part of the system design. It hides internal implementations and provides a set of external interfaces. Components that meet the same interface in the system can be freely replaced

Node)
In order to effectively model the deployed structure, UML introduces the concept of nodes, which can be used to describe the basic hardware for running software such as PCs, printers, and servers.
A node is a physical element that exists during running. It represents a computing resource and usually has at least storage space and processing capabilities.

1.2. Behavior Elements
Interaction: a set of information exchanged between a group of objects that jointly complete a task in a specific context.
The interaction representation is very simple. It is a straight line with the operation name on it.
State machine: a sequence of states that an object or interaction experiences in responding to events within its lifecycle.
In the UML model, the state is drawn as a rounded rectangle, and the state name and its substate are written in the rectangle.

1.3 Group Elements
A medium-and large-sized software system usually contains a large number of classes, so there will be a large number of structured and behavioral things. In order to be more effective in its integration, to generate a model that is either simple or traditional, or macroscopic or microscopic, You Need To group it. In UML, "Package" is provided to achieve this goal.

1.4. annotation Elements
Structured things are the main construction blocks of the model, and behavioral things supplement the dynamic part of the model. grouping things are used to better organize the model, and it seems that they are complete. Annotations are used to add appropriate interpretations to the UML model.

2. Relationship
UML models have many relationships,

2.1 Association
Association indicates a semantic relationship between two classes. A link provides a communication path, which is the most common and has the weakest semantics among all links.
In UML, a solid line is used to represent an association.
There are two special associations: Aggregation and combination.
Aggregation relationshipAggregation is a special form of association. Aggregation indicates that the relationship between classes is the relationship between the whole and the part.
If the "Part" class is found to be completely dependent on the "whole" class, use the "Combination" link to describe it.
CombinationIs a variant of aggregation and adds some important semantics. That is to say, in a composite relationship, an object is only a part of a combination at a time. "whole" is responsible for the creation and destruction of "part". When "whole" is damaged, "Part" disappears.
Aggregation is like a car and a tire, and a broken tire can be used. A combination is like a combination of a company and its subordinate departments. If the company fails, the Department does not exist!

2.2 generalization, implementation and dependency
The general relationship describes the relationship between a general thing and a special type of the thing, that is, the relationship between the parent class and the Child class.
The implementation relationship is used to specify the relationship between interfaces and the classes or components that implement interfaces. An interface is a set of operations used to specify the services of a class or component.
There are two elements X and Y. If you modify the definition of element X, you may modify the definition of another element Y, which is called element Y Dependency on element X.

Ii. Rules

Name: that is, the name of the thing, link, and graph. Like any language, a name is an identifier.
Scope: similar to the scope of the class.
Visibility: Public, Protected, Private, Package

Iii. UML public mechanism

1. Specification Description
Each part of the graphic representation is followed by a Specification Description (also called details), which is used to describe the syntax and semantics of the constructed block. This idea separates the Visual View from the Text View:

2. UML modification and General Division
In order to better express these details, UML also provides some modifiers, such as symbols of different visibility and abstract classes in italics.
General UML Division:
1) classification of classes and objects: classes are abstract and objects are specific instances.
2) Separation of interfaces and implementations: interfaces are a declaration, a contract, and a service entry. implementations are the contracts provided by interfaces.

3. UML Extension Mechanism

This part is not easy to describe, to be modified (invitation month note 2009.2.18)

Constructor: in the actual modeling process, you may need to define the constructor blocks specific to a specific domain or system.
The tag value is used to add new features to a transaction. The Mark value is represented by a string such as "{mark information }".
A constraint is a mechanism used to add new semantics or change existing rules (free text and OCL ). The representation of constraints is similar to the markup value method. They are represented by strings enclosed in curly brackets. However, they cannot be placed in the element but near the relevant element.

4. UML view and diagram

Graph name function remarks
Class diagram description Class, Class characteristics and relationships between classes UML 1 original
An object diagram describes a snapshot of each object in the system at a time point. UML 1 Informal Diagram
Decomposition of runtime of composite structure diagram description class new in UML 2.0
Component diagram describe the structure and connection of the component original in UML 1
Deployment diagram describe the original deployment of UML 1 on each node
The package diagram describes the informal diagrams in the hierarchical UML during compilation.
Use case diagram to describe how users interact with the system original UML 1
Activity diagram description process behavior and parallel behavior original UML 1
The state machine diagram describes how events change the object lifecycle. The original UML 1
The sequence diagram describes the interaction between objects, focusing on the original sequence UML 1.
Communication diagrams describe the interaction between objects, focusing on connecting the collaboration diagrams in UML 1
A timing chart describes the interaction between objects, with emphasis on the addition of a scheduled UML 2.0
An interactive overview diagram is a hybrid addition of a sequence diagram and an activity diagram in UML 2.0.



Appendix: Relationship between the development process and the diagram

Pause. Wait for the next article! Haha!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.