知识点:
Entity: list of things you need to notice down
Attribute: details/specific
for example:
Entity (Class): Person
Attribute: id, name. age, contact number, etc.
Method list: getID(), getAge()
注意⚠️:取名逻辑应该跟sourcecode相同,思维方式也应该按照programmer的思维来思考
在结构分析与设计中,组合(Composition)和聚合(Aggregation)是面向对象建模中的两个关键概念,它们用于定义系统中不同组件之间的关系。这些概念在统一建模语言(UML)和系统架构中尤为重要。
特性 | 组合(Composition) | 聚合(Aggregation) |
---|
所有权 | 强(父对象控制子对象) | 弱(父对象不控制子对象) |
存在依赖 | 子对象依赖于父对象 | 子对象可独立存在 |
UML符号 | 实心菱形(◆) | 空心菱形(◇) |
示例 | 建筑物中的房间 | 城市中的建筑物 |
Analysis phrase 具体步骤
1. Indicate Association 定义关系
比如一个人会有一个地址,那么:
class Person: def __init__(self, address): self.address =
2. Analyze Multiplicity 定义数量
example:
Each customer has one or more account
Each account must belong to one or more person
注意⚠️: 虽然和ER-diagram很相似,domain-class diagram 决定的是怎么编程,怎么转变为software,但ER-diagram定义的是数据库。
- 在定义关系的时候,如果混淆,会容易把foreign key等概念带进来
Considerations 💭:在设计的时候,需要考虑未来的可能性,因为clients might have different needs in the future, so it is possible that you have to redesign it again.
Planning phase:
Goal: establish the scope of the system
Tool: role map
之后想到更多再继续补充,如果有错误欢迎指正~