One What is it? ?
UML yes Unified Model Language Abbreviation of , Chinese is the unified modeling language , Is a standardized modeling language composed of a complete set of charts
through the use of UML Before software development , Better readability for the whole software design , Comprehensibility , To reduce development risk . meanwhile , It can also facilitate communication between developers .
UML It provides a modeling language with strong expression ability , Different people in the process of software development can get information of their own interest .
Page-Jones stay 《Fundamental Object-Oriented Design in UML》 The book concludes UML Main purpose of , as follows ：
Provide users with ready-made , Expressive visual modeling language , So that they can develop and exchange meaningful models .
Provide scalability for core concepts (Extensibility) And specialization (Specialization) mechanism .
Independent of specific programming languages and development processes .
Provides a formal foundation for understanding modeling languages .
Encourage the development of object-oriented tool Market .
Support higher level development concepts , Such as collaboration , frame , Modes and components .
Integrate best practices (Best Practices).
Three UML What are the pictures ?
UML Graph is divided into structure graph and behavior graph .
Structure chart is divided into class chart , Outline drawing , Component diagram , Combined structure chart , Object graph , Deployment diagram , Package diagram .
Behavior chart is divided into activity chart , Use case diagram , State machine diagram and interaction diagram .
The interaction graph is divided into sequence graph , Sequence diagram , Communication diagram , Interaction Overview Diagram .
What is a class diagram ?
【 concept 】 Class diagram is the core modeling tool of all object-oriented methods . Class diagrams describe the types of objects in the system and the static relationships between them .
【 objective 】 Used to represent a class , Interfaces and their static structures and relationships .
In the class diagram , There are several common relationships .
【 Generalization relation 】 It's an inheritance relationship , Indicates that the subclass inherits all the characteristics and behaviors of the parent class .
【 Arrow points 】 Solid line with triangle arrow , Arrow points to parent class .
【 Realization relationship 】 It's a kind of relationship with interfaces , Presentation class is the implementation of all features and behaviors of interface .
【 Arrow points 】 Dotted line with triangle arrow , Arrow points to interface .
【 Relationship 】 It's a kind of ownership , It makes one class know the properties and methods of another .
【 Code embodiment 】 Member variable
【 Arrow points 】 Solid line with normal arrow , Point to the owner . A two-way association can have two arrows , Or no arrows . One way association has an arrow .
Car bought by myself , Drive whenever you want . But the car is the car , Man is man , There is no relationship between the whole and the part .
【 Aggregation relationship 】 It's a whole part relationship . And parts can be separated from the whole and exist alone . Aggregation is a kind of relation , It's a strong relationship ; Association and aggregation are syntactically indistinguishable , We must examine the concrete logical relations .
【 Code embodiment 】 Member variable
【 Arrow points 】 Solid line with hollow diamond , Hollow diamond points to the whole .
Computers have keyboards to enter information , Computer is the whole , The keyboard is part , The keyboard can also leave the computer , Just knock . So it's aggregation .
【 synthetic relation 】 It's a whole part relationship . But part cannot exist alone without the whole , Combination relation is a kind of association relation , It's a stronger relationship than an aggregate relationship .
【 Code embodiment 】 Member variable
【 Arrow points 】 Solid line with black diamond and ordinary arrow , Black Diamond points to the whole
Birds are the whole , Wings are parts . The bird is dead , The wings can't fly . So it's a combination . Let's take another look , Here is an example of a classic set of aggregation and composition relationships .
A company has multiple departments , There is a combination relationship between the company and the Department , The company went bankrupt , The Department will no longer exist . Departments and employees are aggregations , Department cut , The staff will change their homes .
rely on （Dependency）
【 Dependency 】 It's a use relationship , That is, the implementation of one class needs the assistance of another class .
【 Arrow points 】 Dotted line with normal arrow , Ordinary arrow points to the user .
What is a component diagram ?
【 concept 】 Describes the , Required interfaces , Port, etc , And the relationship between them .
【 objective 】 Used to show dependencies between components .
Order system components depend on customer repository and inventory system components . Dotted arrows in the middle indicate dependencies . Two other symbols , Represents a component connector , One provides the interface , One needs an interface .
What is deployment diagram ?
【 concept 】 It describes how the software in the system is distributed on different nodes .
【 objective 】 Used to represent the mapping relationship between software and hardware .
What is an object graph ?
【 concept 】 Object graph is an example of class graph , Is a snapshot of the detailed state of the system at a point in time .
【 objective 】 Used to represent the relationship between two or more objects at a certain time .
It's described in the figure , Some time bat This company has a R & D department , A sales department , There's only one person in two departments iisheng.
What is a bag chart ?
【 concept 】 Describes the structure design of the system at the package level .
【 objective 】 Used to represent dependencies between packages .
《Use》 Relationship represents use dependency ,Web Shopping rely on Payment
《Merge》 Relationship represents consolidation ,Web Shopping Merged Shopping Cart You have it Shopping Cart Function of
《Access》 Relationship represents private import , For example, the specified package name class name in the code
《Import》 Relationship represents public introduction , such as Java In import after , It can be used directly import Class in package .
What is a composite structure chart ?
【 concept 】 Describes a " composite structure " Internal structure of , And their relationship . this " composite structure " Can be part of the system , Or a whole .
【 objective 】 Used to represent the logical " composite structure ".
The figure shows Car Two front wheels connected by an axle , Two rear wheels , Combined with engine .
What is a contour map ?
【 concept 】 Contour map provides a general extension mechanism , For domain and platform specific customization UML Model .
【 objective 】 For building in a specific domain UML Model .
In the figure, we define a simple EJB Overview of .Bean From Component Extended .Entity Bean and Session
Bean Inherited Bean.EJB have Remote and Home Interface , and JAR package .
What is a use case diagram ?
【 concept 】 Use case diagrams are defined by the actors , Use cases , A view of the boundaries and their relationships to describe the functions of a system .
【 objective 】 Used to describe the function of the whole system .
The use case diagram contains the following three relationships ：
Include relationship usage symbols 《include》, Want to view order list , If you need to log in first .
Extended relationship usage symbols 《extend》, Function based on order list query , You can add a function to export data
Generalization relation , Child use case inherits all structure of parent use case , Behavior and relationship .
What is activity map ?
【 concept 】 Describes the implementation process of specific business use cases .
【 objective 】 Workflow used to represent use case implementation .
It is simply described in the figure , From start to login to view order list , Or the login fails and ends directly
What is a state machine diagram ?
【 concept 】 Behavior modeling of a single object by state machine graph , Indicates that the object is in its entire life cycle , When responding to different events , Sequence of execution related events .
【 objective 】 Used to represent the specified object , Throughout the life cycle , Respond to different states of different events
What is sequence diagram ?
【 concept 】 Sequence diagrams show how objects collaborate based on time series . It shows that in a specific scenario of a use case , How objects interact with other objects .
【 objective 】 Display dynamic collaboration among multiple objects by describing the time sequence of sending messages between objects .
The chart shows the sequence diagram of Alipay barcode payment scenario . among ,loop It's a cycle ,alt It's a choice , Other relations of sequence diagram will not be introduced here .
What is a communication diagram ?
【 concept 】 Describes the organization relationship of the objects receiving and sending messages , Emphasize the cooperation between objects rather than time sequence .
【 objective 】 Used to display the relationship between different objects .
The picture shows the communication diagram of an online bookstore , Box and villain represent lifeline , Messages can be passed between different lifelines , The number in front of the message can express the sequence order .
What is interaction overview ?
【 concept 】 The interaction overview is similar to the activity diagram , But its nodes are interaction graphs .
【 objective 】 Provides an overview of control flow
The diagram shows the interaction overview of a scheduling system , It's very similar to the activity map . among sd The box of represents the specific interaction process ,ref Box represents use interaction .
What is a sequence diagram ?
【 concept 】 Time sequence diagrams are used to show changes over time , Changes in the value or state of one or more elements . It also shows the interaction between time control events and their time and duration constraints .
【 objective 】 A view that represents the state or value of an element as it changes over time .
study UML, We don't have to worry about things like whether we have an arrow or not , Such a problem . what's more UML The thought of drawing brought by drawing , Let's draw UML Pictures or other pictures can help others better understand our design ideas .