The class diagram is the most-used, most-misused UML diagram. Easy to read in a single example; harder to draw when domain semantics get complex. This walks every relationship type once, end to en...
类图是最常用却最容易被画错的 UML 图。零基础谁都看得懂,复杂了经常因为箭头画错让评审反复确认。这是一篇把类图所有关系一次说清楚的文章。
类成员可见性12345678910111213141516171819202122@startumlclass User { -id: Long -name: String #email: String ~passwordHash:...
Use case diagrams are the most underused UML type. They don’t draw code; they precisely describe what value a system provides and who uses it.
One-line definitionA use case diagram = a set o...
用例图是 UML 里最容易被低估的一张图:它不画代码,但能精确地描述系统对外提供什么价值,谁来用,怎么用。
一句话定义用例图描绘一组参与者 + 一组用例 + 它们之间的关系,加上一个系统边界包住用例。
123456789101112131415161718192021222324@startumlleft to right directionskinparam actorStyle aw...
类图描绘「一个类怎么和别的类互动」,组件图描绘「文件 / 模块怎么组装」,部署图描绘「运行时节点怎么连」。三层一起用是描述完整架构的标准做法。
三层架构图
层级
描绘什么
读者
PlantUML 关键字
类图
类之间的字段、方法、继承关系
开发
class / abstract / interface
组件图
文件 / 模块 ...
Class diagrams show “how classes relate.” Component diagrams show “how files / modules assemble.” Deployment diagrams show “how nodes connect at runtime.” Stack the three — that’s the standar...
Activity diagrams are often overlooked — they’re more powerful than flowcharts. This covers everything from basics to fork/join/exception handling.
Activity vs Flowchart
Dimension
Flo...
活动图经常被忽略 —— 比流程图更像流程图。这篇覆盖从基本语法到分叉 / 合并 / 异常处理。
活动图 vs 流程图
维度
流程图
活动图
表达
数据 / 控制流向
业务活动 / 流程 / 角色协作
角色划分
不区分
支持 partition / swimlane
并发
弱
强(fork / join...
State diagrams are the most underused PlantUML type. They precisely describe all legal states of a domain object (order, login session, approval flow), transitions, guards, and entry actions.
Wha...
状态图是 PlantUML 里被低估的一类图:能精确描绘复杂对象(订单、登录会话、提交流程)的所有可能状态、转换条件和进入动作。
状态图能解决什么问题业务里的订单生命周期经常这样:
待付款 → 已付款 → 发货中 → 已签收 → 已完成
已付款 → 申请退款 → 已退款
待付款 → 取消
已签收 → 申请售后 → 售后处理中 → 售后完成
代码实现时这些都是 if/else...