当前位置:网站首页>Six relationships between UML models and classes
Six relationships between UML models and classes
2022-07-21 20:12:00 【Old [email protected]】
UML Basic introduction
UML chart
- Use case diagram
- Static structure diagram : Class diagram 、 Object graph 、 Package diagram 、 Component diagram 、 Deployment diagram
- Dynamic behavior diagram : Interaction diagram ( Sequence diagrams and collaboration diagrams )、 State diagram 、 Activity diagrams
Relationship between classes
Dependency relationship
As long as it's in the Class needs to use each other , Then there is a dependency between them , If there is no class used , Unable to compile
- Member variables of class
- The return type of the method in the class
- Type of parameter received by method in class
- Method used in
class B{
private C c;
public C getC(){
return c;
}
}
class C{
}
class A{
private B b;
public C getC(){
return b.getC();
}
}
This means A rely on B and C,B rely on C
Generalization relation
Generalization is actually inheritance , It is a special case of dependency
class B{
}
class A extends B{
}
here A generalization ( Inherit ) 了 B
Realization relationship
Realizing a relationship is actually A Realized B The abstract method in , It is A special case of dependency
interface B{
}
class A implements B{
}
here A Realized B
Connections
Correlation is actually The relationship between classes , He's a special case of dependency
The association is navigable : That is, two-way relationship and one-way relationship
Relationships are multiple , Such as 1 It means a ,0… Express 0 One or more ,“0,1” Express 0 One or one ,“n,m” Express n To m Every one can ,m… At least m individual
class B{
}
class A{
private B b;
}
This is a one-way Association
class B{
private A a;
}
class A{
private B b;
}
This is a two-way correlation
Aggregate relationship
An aggregate relationship is a relationship between the whole and the part , The whole and the part can be separated , Aggregation is a special case of association , So it has directionality and multiplicity ( Class , It can be for null, It can also be done through set Method to set the value , It means aggregation )
class A{
private B b;
public void setB(B b){
this.b = b;
}
}
here B Aggregated in A
synthetic relation
The combinatorial relationship is also the relationship between the whole and the parts , But the whole and part cannot be separated , Because the whole is made up of parts , Indispensable ,( Class , There is a non empty default value , Or the value is assigned in the constructor , Represents a combinatorial relationship )
class A{
private B b = new B();
}
here B Combined in A
版权声明
本文为[Old [email protected]]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/202/202207210454015389.html
边栏推荐
- Jd.com's popular architect growth manual is launched, and you deserve the architect aura
- 汇编借助于条件转移实现循环判断是否为平方数
- 1451 - Cannot delete or update a parent row 具有多个外键约束 删除子表数据行的问题
- In fastjason data type, there is a problem of $ref: "$.list[0]" when parsing jsonobject
- Metauniverse iwemeta: the new cover of time magazine, metauniverse will change everything
- Corn expression usage
- MySQL之DQL(数据查询语言)-常见函数
- Quartz创建定时任务(入门)
- Linux Redis-6.2.6单机部署
- 支持数据 + 代码生成的开发工具,yyds
猜你喜欢
判断“String[]”数组中是否有存在重复的值,利用hashSet特性排查
论文阅读 (61):Multi-Instance Attention Network for Few-Shot Learning
Ibm3650m4 physical machine installation esxi7.0
3-6月面经总结,200多页真题笔记和详解(含核心考点及6家大厂)
One of the problems to solve the sorting order error of Oracle database query single table
Gaode map API obtains the surrounding information corresponding to the current location
Error in pulling project POM file, Jai_ core-1.1.3. Jar, solve the problem of introducing jar
高德地图API获取当前位置对应的周边信息
Introduction, installation and basic use of MYCAT
Wechat official account development access, using wechat public platform to apply for test number for local development
随机推荐
867. Decomposition prime factor
Ibm3650m4 physical machine installation esxi7.0
从20s优化到500ms,我是如何做到的
uniapp开发app解决uni.pageScrollTo不生效
解决Oracle数据库查询单表排序顺序错误问题之一
As editor sets the indent position of the code on the right side of fluent development
MySql update语句或者delete语句 where条件没走索引会锁表
Redis installation of Linux system
MySQL之数据库设计三范式
数据库宿舍管理系统
MySQL UPDATE statement or delete statement where condition will lock the table if there is no index
In fastjason data type, there is a problem of $ref: "$.list[0]" when parsing jsonobject
Chart is code: build a new generation of graphics library in a coded way -- feekin
@Scheduled 定时任务详解
类加载器及双亲委派机制
How do I optimize from 20s to 500ms
One of the problems to solve the sorting order error of Oracle database query single table
利用反汇编调试与补码解释0x80000000 / -1整形输出异常不一致
The JSON tool converts objects to JSON format strings
Notes on the method of construction - Chapter 6 agile process