UML Final Review Notes

Foreword : There are two exam subjects left at the end of this semester, one of which is UML, so I summarized this note according to the courseware explained in the teacher's class, and memorized it while organizing it, which is also convenient for future study and reference

1. Object-oriented and UML
2. Use case diagram
3. Class diagram
4. Object diagram 5.
Package diagram
6. Sequence (sequence) diagram
7. Collaboration diagram
8. State diagram
9. Activity diagram 10.
Component diagram
11. Deployment diagram


1. Object-oriented and UML

1. Object-oriented method
A development method that uses object-oriented software construction concepts and principles (classes, objects, abstraction, encapsulation, inheritance, polymorphism, and messages) to construct software systems

2. Object-oriented features
abstraction, encapsulation, inheritance, polymorphism

3. UML definition is
a standard graphical modeling language, which is a standard representation of object-oriented analysis and design

4. UML composition
Basic building blocks (modeling elements, relationships, diagrams), UML rules, general (public) mechanisms

5. UML building block
(1) 4 things : structure, behavior, grouping, annotation
(2) 4 relationships : dependency, association, generalization, realization
(3) 9 types of diagrams : static diagrams (use case diagrams, class diagrams, object diagrams, component diagrams, deployment diagrams); dynamic diagrams (sequence diagrams, collaboration diagrams, state diagrams, activity diagrams)

6. UML rules
include naming, scope, visibility, integrity, execution

7. UML public mechanism
includes specification, modification, general division, and extension mechanism (stereotype, tag value, constraint)
(1) Stereotype : predefined << include >>, << extend >>; user-defined and Start with a capital letter
(2) Tag value : in the form of "name=value"
(3) Constraint : in the form of {constraint content}

8. UML view (4+1)
(1) Logical view (Logical View) : represents the conceptual design of the system and the subset system, etc.
(2) Implementation View (Implementation View) : explains the structure of the code
(3) Process view (Process View) : Explain the concurrent execution and synchronization in the system
(4) Deployment View (Logical View) : Define the physical structure of hardware nodes
(5) Use Case View (Use Case View) : Express the functional requirements of the system from the perspective of external users

9. UML conducts object-oriented system analysis steps
(1) Identify system use cases and roles
(2) Conduct system analysis and abstract classes
(3) Design the system and design the classes and their behaviors, including structural design and detailed design


2. Use case diagram

1. Definition of use case diagram
It represents the diagram of the relationship between use cases and participants in a system, and describes the related users in the system and the functions and services provided by the system to different users (describe from the perspective of users, analyze system functions and behaviors)

2. Use case diagram composition
(1) Actor
(2) System boundary (System scope)
(3) Use case
(4) Association

3. Actors are defined
outside the use case, which can be people or other external systems. The illustration is
insert image description here

4. Participant determination method

  • People who use the main functions of the system (principal roles)
  • People who use systems to get their daily work done
  • People who maintain and manage the system (secondary role)
  • hardware devices, other system interactions, people or things interested in system results

5. The relationship between participants
is mainly a generalization relationship, that is, the common behavior of some participants is extracted to represent the general behavior (hollow triangle arrow solid line, arrow pointing to the super class)

6. An example
insert image description here
Description: The manager inherits the behavior of the employee and thus can participate in all use cases

7. Use case
(1) concept : describe the function of the system from the perspective of the user

(2) Recognition method (find event) : subject (participant) + verb (use the system) + object (achieve the goal)

(3) Key points analysis

  • Use cases are result values ​​(achieved goals) produced by the system
  • Use cases must be realized by the target system
  • Use cases are proposed and defined in terms of actors

(4) Relationship
Participants and participants: generalization
Use cases and participants: association (one-to-one communication, a solid line, arrows are optional)
use cases and use cases: inclusion, generalization, extension

8. The relationship between use cases
(1) includes : the step of reusing another use case in one use case, which is characterized by a dotted line, and the arrow points from the base use case to the included use case, example: when to use: the use case has too many functions, and it is decomposed into small use cases;
insert image description here
use cases The common behavior is separately abstracted into a use case, and other use cases can include this use case

(2) Generalization : One use case inherits another use case, general and special relationship, example:
insert image description here
when to use : the same business purpose is realized by different technologies

(3) Extension : Add steps to existing use cases to create new use cases, characterized by a dotted line, and the arrow points from the extended use case to the basic use case, example:
insert image description here

9. Use case granularity
The way and level of refinement of use case organization information

10. Use case specification Used
to describe use cases, including brief description, event flow (basic flow, alternative flow), use case scenarios, special requirements, preconditions, postconditions, examples:
insert image description here


Three, class diagram

1. Class diagram definition
Several classes are associated together to reflect the static diagram of the system or subsystem composition structure

2. The role of class diagrams
Describe the structure of each class in the software system and the relationship between classes

3. Elements of the class diagram
A rectangle containing the class name (Name), attribute (Attribute), and operation (Operation).
(1) Class name : the first letter is capitalized; when it consists of multiple letters, it needs to be combined, and the first letter of the second word is capitalized
(2) Attribute : the syntax is [visibility] attribute name[:attribute type] [=initial value] [ {feature}], where visibility includes public type (+) (public), protected type (#) (protected), private type (-) (private), single-word attribute name in lowercase; multiple words, except the first The first letter of the rest of the words outside the word should be capitalized
(3) Operation : the syntax is [visibility] operation name [(parameter list)] [:return type] [{characteristics}]

4. Types of classes
(1) Entity class (Enity) : A class used to model the information and related behaviors that must be stored. In the end, it may be mapped to tables and fields in the database. The legend is
insert image description here

(2) Control class (Control) : Responsible for coordinating the work of other classes, it does not complete any functions itself, the illustration is
insert image description here

(3) Boundary class (Boundary) : located at the top of the system, including all hardware interfaces such as windows and reports, and interfaces of other systems, the illustration is
insert image description here

5. Relationship between class diagrams
(1) Generalization (is a kind of) : The class described generally is called the parent class, and the class described specifically is called the subclass. In addition to inheriting the properties and operations of the parent class, the subclass also adds its own properties and operations. The illustration is
insert image description here

(2) Realization : An interface describes a set of methods, modeled as a realization relationship. The implementation relationship is represented by a dotted line with a closed empty arrow; the interface is represented by a circle, and the realization relationship is represented by an implementation attached to the rectangle representing the class. The illustration is
insert image description here

(3) Dependency (Dependency) : Indicates that a class uses the method of another class or a class uses the properties and methods defined by other classes, emphasizing that changes in classes cause corresponding changes in other classes, indicated by dotted arrows, and the legend is
insert image description here

(4) Association (Association) : Indicates that an object owns another object, represented by a solid triangle arrow, and its characteristics include association name, role, multiplicity, navigation, constraints, and special associations. The legend is
insert image description here

(5) Combination : Indicates the relationship between the whole and the part. The part and the whole have the same life cycle. It is represented by a solid diamond head, and the head points to the whole. The legend is
insert image description here

(6) Aggregation (aggregation) : A class is composed of several partial classes, and a part can exist independently of the whole. It is represented by an empty diamond-shaped line segment, and the head points to the whole. The legend is
insert image description here

(7) Relationship case
insert image description here

6. Class identification
(1) Noun identification method : identify the entities described by nouns or noun phrases used in the problem domain. Identify nouns, pronouns, and noun phrases, mark them as initial classes, and then remove redundant classes, irrelevant classes, fuzzy classes, classes that are not independent in nature, and describe temporary objects to confirm classes and cases
insert image description here
insert image description here
insert image description here

(2) Entity Recognition : Concerned about the entities that make up the system. Including information entities, equipment, external equipment interacting with the system, system related personnel, system organizational entities, cases
insert image description here
insert image description here

(3) Use case identification method : identify each use case separately

7. Class diagram drawing steps
(1) Create a class diagram
(2) Research and analyze the problem area to determine the system requirements
(3) Determine the classes and their associations according to the same example diagram or requirements, clarify the meaning and responsibility of the classes, and determine the attributes and operations
(4) ) Add classes and their attributes and operations
(5) Add relationships between classes


4. Object diagram

1. Object diagram definition
Describes the state of each object participating in the interaction at a certain moment in the interaction process

2. Object graph representation
It consists of objects (Object) and chains (Link).
(1) Object : Use an underscored instance name to distinguish it as an individual. The syntax is: object name: class name
(2) chain : one or more connected lines or arcs, the legend is
insert image description here

Five, package map

1. Package Diagram Definition
A diagram that describes the organization of packages and contained elements in a model. Contains elements and relationships between packages, legend
insert image description here

2. The function of package diagram
is used to organize use case diagram and class diagram

3. Principle of division
Low coupling, high cohesion

4. Relationship
Dependency, Generalization

5. Problem
Circular dependency, the solution is to re-package, introduce a third package, and re-establish dependencies

6. Sequence (sequence) diagram

1. Dynamic analysis
(1) Task : Model the behavior of object groups, express the action collaboration relationship between objects, describe the implementation of use case behavior, and display the objects involved in use case implementation/class operations and the message transmission between objects (2)
Overview : Dynamic The analysis model describes the dynamic behavior of the system, and mainly establishes the interaction diagram (sequence diagram, collaboration diagram) and behavior diagram (state diagram, activity diagram) of the system

2. Sequence diagram definition
Describes the interaction between objects organized in time order

3. Elements of the sequence diagram
(1) Object : the basic unit participating in the interaction, which can be created or deleted during the interaction. The illustration is
insert image description here

(2) Lifeline : Indicates that an object exists within a period of time, the legend is
insert image description here

(3) Activation : Indicates the time period for an object to perform an action. The object starts the activity when it receives a message. The legend (hollow rectangular bar) is
insert image description here

(4) Message : A message is a communication between objects, the illustration is
insert image description here

4. Message type
(1) Call (synchronous) message : the sender requests the receiver object to perform some operation, which means blocking and waiting. The illustration is
insert image description here

(2) Asynchronous message : After the message is sent, the sender continues to operate without waiting. It is used for concurrency, which means non-blocking. The illustration is
insert image description here

(3) Return message : the return of the message, the legend is
insert image description here

(4) Message summary
insert image description here

5. Sequence diagram drawing steps
(1) Set the context of interaction
(2) Set the scene of interaction
(3) Set the lifeline for the object (4
) Arrange messages in chronological order (
5) Set the activation period
(6) Additional time and space constraints

6. When to choose a sequence diagram
, mainly for the message flow during a specific interaction


7. Collaboration diagram

1. The definition of the collaboration diagram
emphasizes the organizational structure of the objects that send and receive messages

2. Elements of the collaboration diagram
(1) Object : in the form of object name: class name
(2) Message : composed of sender, receiver, and activity
(3) Chain : an independent connection between two or more objects, in the form is one or more connected lines or arcs, the legend is
insert image description here

3. The role of the collaboration diagram
to represent the realization of a class operation, to display the spatial organization structure of objects and their interactions, and to represent the scheme

4. When to choose a collaboration diagram
When focusing on the links between the different actors and objects involved in the interaction


8. State diagram

1. State diagram definition
Describes all possible states of a specific object, and can also describe events that cause state transitions

2. Elements of the state diagram
(1) Initial state
(2) Termination state
(3) State : represented by a rectangle with rounded corners, including name, entry and exit actions, and internal transitions. The legend is
insert image description here

(4) Transition : A relationship between two different states, including source state, trigger event, monitoring event, action and target state, the legend is
insert image description here

(5) Judgment : Contains one transfer-in and two transfer-outs, the legend is
insert image description here

(6) Synchronization : Indicates the branching and merging of concurrent workflows, represented by a line segment, the legend is
insert image description here

(7) Concurrent branches : Divide a single workflow into two or more workflows, and the workflows of several branches are performed in parallel

(8) Concurrent Confluence : Two or more concurrent workflows are synchronized here

3. State diagram drawing steps
(1) Find out the class that is suitable to use the model to describe its behavior
(2) Determine the state that the object may exist
(3) Determine the conditions that cause the state transition
(4) Determine the corresponding action that the object performs when the transition is in progress
( 5) Refine and refine the modeling results accordingly


9. Activity diagram

1. Activity diagram definition
Describes the sequence of activities and shows the control flow from one activity to another

2. Elements of activity diagram
(1) Action
(2) Activity
(3) Action flow
(4) Branch and merge
(5) Fork and merge
(6) Swimming
lane (7) Object flow
The legend is
insert image description here
insert image description here

3. Activity diagram drawing steps
(1) Define what the activity diagram should model
(2) Add start and end points
(3) Add activities
(4) Add transitions between activities
(5) Add decision points
(6) Find out where parallel activities are possible


10. Component diagram

1. Component diagram definition A
diagram representing the relationship between components in the system, as well as between defined classes or interfaces and components

2. Elements of component diagram
(1) Component
(2) Interface
(3) Dependency relationship
The legend is
insert image description here


11. Deployment diagram

1. Deployment diagram definition
Used to show the physical architecture of software and hardware in the system

2. Deployment diagram case
insert image description here

Guess you like

Origin blog.csdn.net/qq_44858224/article/details/112176460