Introduction of Software Engineering (UML class diagram relations and class)

emmmmmmmmmmmm
Introduction to Software Engineering: a joyful listen (play the game), happy (late at night) drawing, happy to check the experimental class
quick examination
recorded the joy of learning and the relationship between the UML class diagram class of 2 hours crash Dharma

Here Insert Picture Description

Dashed arrows pointing dependence;

A solid line arrow pointing association;

A broken line triangle pointing to the interface;

The solid line triangle pointing to the parent class;

Open diamonds can be separated and made independent, it is polymerized;

Filled diamonds precision associated inseparable, a combination thereof;

When drawing class diagrams, and clarify the relationship between the class and the class is the key. There generalization relationship classes, implementation, dependence and association. Wherein the correlation is divided into general association and aggregation relationship, the relationship between the synthesis. Now we understand these relationships with examples.

basic concepts

FIG class : class diagram modeling object-oriented systems is the most common and most important diagram, is basis for the definition of other figures. FIG class system is mainly used to display the classes, interfaces and one static model static structure and the relationship between them.

FIG class three basic components: a class name, property, method.
Class Diagram
Generalization : shows a relationship between the is-a, the maximum degree of coupling is a relationship between objects, subclass inherits all the details of the parent class. Directly inherited expression language. Class diagram in solid line with arrowheads represent the arrow pointing from the subclass parent class.
Generalization
Realization : that the relationship between the interface and implementation in the class diagram. In the class diagram of the dotted line with triangular arrow, arrows pointing from the class that implements the interface.
Here Insert Picture Description

依赖:对象之间最弱的一种关联方式,是临时性的关联。代码中一般指由局部变量、函数参数、返回值建立的对于其他对象的调用关系。一个类调用被依赖类中的某些方法而得以完成这个类的一些职责。在类图使用带箭头的虚线表示,箭头从使用类指向被依赖的类。
Here Insert Picture Description

关联: 对象之间一种引用关系,比如客户类与订单类之间的关系。这种关系通常使用类的属性表达。关联又分为一般关联、聚合关联与组合关联。后两种在后面分析。在类图使用带箭头的实线表示,箭头从使用类指向被关联的类。可以是单向和双向。
Here Insert Picture Description

聚合 : 表示has-a的关系,是一种不稳定的包含关系。较强于一般关联,有整体与局部的关系,并且没有了整体,局部也可单独存在。如公司和员工的关系,公司包含员工,但如果公司倒闭,员工依然可以换公司。在类图使用空心的菱形表示,菱形从局部指向整体。
Here Insert Picture Description

组合 : 表示contains-a的关系,是一种强烈的包含关系。组合类负责被组合类的生命周期。是一种更强的聚合关系。部分不能脱离整体存在。如公司和部门的关系,没有了公司,部门也不能存在了;调查问卷中问题和选项的关系;订单和订单选项的关系。在类图使用实心的菱形表示,菱形从局部指向整体。

Here Insert Picture Description

多重性: 通常在关联、聚合、组合中使用。就是代表有多少个关联对象存在。使用数字…星号(数字)表示。如下图,一个割接通知可以关联0个到N个故障单。

Here Insert Picture Description
Aggregation and combination of the difference between
these two relatively difficult to understand, Let us focus. Polymerization, and combinations differences: the polymerization relationship "has-a" relationship, combining relationship is "contains-a" relationship; an aggregation relationship represents relationship between whole-part is relatively weak, while the combination of relatively strong; polymeric relationship represents the parts of something independent of the lifetime of the object and the object on behalf of polymerization of things, once you delete aggregate objects do not necessarily delete the object represents part of things. Once you delete a portfolio combination of objects, while also deleted object represents part of things.

Published 31 original articles · won 97 Like · views 550 000 +

Guess you like

Origin blog.csdn.net/qq_43390235/article/details/90598324