C4模型

维基百科,自由的百科全书

C4模型软体系统建模的图形表示技巧[1][2]。C4模型会用到一些现有的建模技巧,例如统一建模语言(UML)及ER模型(ERD),会将系统结构化分解,分解为容器(container)和组件(component)。  

历史[编辑]

C4模型是由软体架构师英语software architectSimon Brown在2006年至2011年之间创建,以统一建模语言4+1视景模型的基础上建立。在2018年在官网上以知识共享许可协议[3]发布,并且也提出相关的文章[4][1]

简介[编辑]

C4模型用以下的几个视角来叙述软体系统的架构[5],会说明系统分解为容器和组件的方式、各元素之间的关系,若是适用的话,也可以说明和使用者之间的关系[3]

C4模型会依其阶层关系来分类[2][3]

  • 系统上下文图(Context diagrams),第一层的图,说明系统、和其使用者以及其他系统的关系。
  • 容器图(Container diagrams),第二层的图,将系统分解为彼此相关的容器(container)。容器可以是应用程序或是资料存储。
  • 组件图(Component diagrams),第三层的图,将容器分别为彼此相关的组件,也说明组件和其他组件(或是其他系统)的关系。
  • 程式码图(Code diagrams),第四层的图,提供架构元素的设计细节,可以对应到程式码。在此层级的C4模型会用到目前已有的标示方式,例如统一建模语言ER模型或是集成开发环境产生的示意图。

C4模型的第一层到第三层,用到五种基础的图示元素:人、软体系统、容器、组件和关系。此技术没有规定元素的布局、形状、颜色或是风格。C4模型建议以嵌套框为基础的简单图表,方便互动式的协作绘图。C4模型也鼓励良好的建模实务,例如在每一个图都加上标题以及图例,以及清楚的标示,以方便目标读者的理解。

敏捷开发社群中,不太希望有制式化的文件方式,以及前期的架构设计,C4模型可以将架构可视化,因此在敏捷社群很受欢迎[6]

相关条目[编辑]

参考资料[编辑]

  1. ^ 1.0 1.1 Richards,Mark; Ford, Neal. Fundamentals of software architecture: an engineering approach. O'REILLY MEDIA. 2019: 293. ISBN 978-1-4920-4342-3. OCLC 1138515057. some standard are emerging for diagramming software architecture (such as software architect simon Brown's C4 model or The Open Group Archimate standard) 
  2. ^ 2.0 2.1 Enríquez, René. Software Architecture with Spring 5. 0 : Design and Architect Highly Scalable, Robust, and High-Performance Java Applications.. Salazar, Alberto. Packt Publishing Ltd. 2018: 41–44. ISBN 978-1-78899-673-0. OCLC 1053798657. 
  3. ^ 3.0 3.1 3.2 Brown, Simon. The C4 model for visualising software architecture. c4model.com (Official site of the modelling technique). [2020-08-22]. (原始内容存档于2010-02-25). 
  4. ^ Brown, Simon. The C4 Model for Software Architecture. InfoQ. 2018-06-25 [2020-08-22]. (原始内容存档于2018-12-12) (英语). 
  5. ^ Keeling, Michael. Design it! : from programmer to software architect. Raleigh, North Carolina. ISBN 978-1-68050-345-6. OCLC 1024312521. 
  6. ^ The Conflict Between Agile and Architecture: Myth or Reality?. resources.sei.cmu.edu. SATURN 2013 conference. Software Engineering Institute of Carnegie Mellon University. [2020-08-22]. (原始内容存档于2021-04-19) (英语). 

外部链接[编辑]