Unified Modeling Language (UML), also known as Unified Modeling Language or Standard Modeling Language, is a graphical Language that supports Modeling and software system development. It provides Modeling and visualization support for all phases of software development, from requirements analysis to specifications. To construction and configuration.

UML is a product of the upsurge in object-oriented analysis and design (OOA&D, OOAD) approaches that occurred in the late 1980s and mid-1990s.

OMG: Object Management Group

UML consists of three elements: the basic building blocks of UML, the rules that govern how these building blocks are placed together, and the common mechanisms that apply to the entire language.

UML has three basic building blocks: things, relationships, and diagrams.

Things are abstractions of the most representative components of a model, including structural things, For example: Class, Interface, Collaboration, UseCase, ActiveClass, Component and Node; Behavior things, such as Interaction, Statemachine, grouping things (Package, Package), annotation things (Note, Note).

Relationships are used to bring things together, including dependency, correlation, generalization, and realization relationships.

There are nine modeling ICONS in UML, namely, Use case diagrams, class diagrams, object diagrams, Sequence diagrams, collaboration diagrams, state diagrams, activity diagrams, component diagrams, and configuration diagrams. Use Case Diagrams describe the impression of a system from the perspective of an external observer. Emphasize what the system is rather than how the system works. Use case diagrams are closely related to the story. A scenario refers to the situation that occurs when an individual interacts with the system.

Use case diagrams are useful in three areas: 1. Determining characteristics (requirements). When the system has been analyzed and designed, new use cases create new requirements; 2. Customer communication. Use case diagrams make it easy to represent the relationship between developer and customer; 3. Generate test cases. A plot of a use case may produce a batch of test cases for those plots.

The Class diagram Class diagram

Represents a system by showing its classes and the relationships between those classes. Class diagrams are static — they show you what can have an impact but don’t tell you when.

The notation for a UML class is a box divided into three blocks: class name, attribute, and operation. The name of the abstract class is italic. The relationships between classes are connections.

The class diagram has three types of relationships: 1. Association association- Represents the relationship between instances of two types. Use associations if an instance of a class must use an instance of another class to get its work done. In the figure, the association is represented by a line between two classes; 2. Aggregation – A special relationship when a class belongs to a container. Aggregation uses a line with a diamond that points to the class of wholeness. In our figure, Order is the container for OrderDetails; 3. Generalization – A generalization that refers to an inheritance line that refers to another class as a superclass. The generalization relation points to the superclass with a triangle. Payment is the superclass of Cash, Check, and Credit.

Package and object diagrams

To easily represent complex class diagrams, classes can be grouped into packages. A package is a collection of logically related components in UML.

Sequence diagram

Are interaction diagrams and are dynamic (they describe interactions between objects).

A sequence diagram represents an interaction as a two-dimensional diagram. Vertically is the time axis, and time extends down a vertical line. The horizontal axis represents the class primitive roles of individual objects in the collaboration. Class meta-roles are represented by lifelines. When the object exists, the role is represented by a dotted line, and when the object’s process is active, the lifeline is a two-trace line.

Messages are represented by arrows from one object’s lifeline to another. Arrows are arranged chronologically from top to bottom in the figure.

Collaboration diagrams

Collaboration diagrams are also interactive diagrams. They convey the same information as sequence diagrams, but they do not care when the message is delivered, only the role of the object. In a sequence diagram, the role of the object is placed on top and the message is the connection line.

The object role rectangle is labeled with the class or object name (or both). The class name is preceded by a colon (:). Each message in a collaboration diagram has a sequence number. The number of the top-level message is 1. Messages of the same rank (that is, messages in the same call) have the same numeric prefix, plus a suffix, 1,2, and so on, depending on the order in which they appear.

State diagram

Objects have behavior and state. The state of an object is determined by its current actions and conditions. The Statechart diagram shows the possible states of the object and the transitions caused by state changes. States are represented by rounded rectangles. Transitions are represented by lines with arrows. The event or condition that triggers the transition is written next to the arrow. The initial state (black circle) is the virtual beginning of the beginning action. The end state is also the virtual end of the action. An event or condition that triggers an action is represented by a/action. The result of the action determines the state of the next step.

Activity diagram

An activity diagram is a very special flow chart. There is a relationship between activity diagrams and state diagrams. The state diagram focuses on the objects in the process, while the activity diagram focuses on a single process action flow. The activity diagram tells us about the dependencies between activities. A branch may branch into two or more mutually exclusive branches. The guard expression (in []) indicates that the transfer is derived from a branch. The branches and the merge at the end of the branches are represented in a diamond. A fork can also be split into more than two parallel activities. Decomposition and the thread joining at the end of decomposition are represented by bold black lines.

Component diagram

Component components are code modules. A component diagram is a physical implementation of a class diagram.

Deployment Diagrams

Displays software and hardware configuration. Physical hardware is represented by nodes. Each component belongs to a node. Components are represented by a rectangle with two small rectangles in the upper left corner.

Detailed content reference

Here are the main points of class diagrams:

Several relationships are common in UML class diagrams:

  • Generalization.

Is an inheritance relationship that represents a general and special relationship that specifies how subclasses specialize all the characteristics and behaviors of their parent class. For example, man is a kind of animal, that is, human characteristics also have animal characteristics. Arrow pointing: A solid line with a triangular arrow pointing to the parent class

  • Realization

Is a class to interface relationship, indicating that the class is the implementation of all the characteristics and behavior of the interface. Arrow pointing: Dashed line with triangular arrow pointing to interface

  • Connection (Association)

Is an ownership relationship that enables one class to know the properties and methods of another class; For example, the relationship between teacher and student, husband and wife can be two-way or one-way. A two-way association can have two arrows or no arrows, and a one-way association has one arrow. Member variable arrows and pointing: solid line with ordinary arrows, pointing to the owner

The teacher and the student are two-way relation, the teacher has many students, the student may also have many teachers. But the relationship between a student and a course is a one-way relationship, a student may take more than one course, the course is an abstract thing he doesn’t own the student. ⭐️ Special case: Self-association

  • Aggregation

Aggregation is the relationship between the whole and the parts, and the parts can exist independently of the whole. If the car and tire are whole and part of the relationship, the tire can still exist without the car. Aggregation relation is a kind of correlation relation, which is strong correlation relation. Association and aggregation are syntactically indistinguishable and must be examined for specific logical relationships. Code: member variable arrow and pointing: with hollow diamond solid line, diamond points to the whole

  • Combination (Composition)

Is the relationship between the whole and the part, but the part cannot exist without the whole. If companies and departments are integral and partial, there would be no departments without companies. Composition relation is a kind of association relation, which is stronger than aggregation relation. It requires the object representing the whole in ordinary aggregation relation to be responsible for the life cycle of the object representing the part. Member variable arrow and pointing: solid line with solid diamond, diamond points to the whole

  • Rely on (Dependency)

Is a usage relationship, that is, the implementation of one class requires the assistance of another class, so try not to use two-way interdependence. Code representation: arrows and Pointers to local variables, method arguments, or calls to static methods: dashed lines with arrows pointing to the user

The order of strength and weakness of various relationships:
Generalization = Implementation > Composition > Aggregation > Association > DependencyCopy the code

StarUML

Product advantages: cross-platform, MAC can also be used, the same effect as Windows, very convenient and unified.

It’s a very broad interface and you can draw it any way you want, okay

In the sidebar, select the appropriate object to add:

Before clicking the object to be added, the mouse state prompt:

After clicking on the object to be added, the mouse state prompts:

Next you can add the object as shown below :(add a class)

Add attributes and methods to the class:

Using the “Delete” key on the drawing interface is invalid. All objects must be deleted by right clicking delete!! Or use the shortcut: Command + “delete”

Other operations on their own to explore it! These operational things to play will be!

StarUML drawing effect and its formatAdditional drawing 🌰 : The order of the relationships in the class diagram

Ah ~ ~! The company asked me to write the SDK and draw the class diagram. Never done before, a face meng force ~! I am exhausted ~ explain the basic use of class diagrams and StarUML!

Follow-up such as detailed operation! The ~ will be added later

(2016.12.21)

goyohol’s essay