阿里巴巴的技术专家,是如何画好架构图的?

                <p style="text-align: right;"><span style="white-space: pre-line;color: rgb(136, 136, 136);font-family: -apple-system-font, system-ui, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;font-size: 10px;letter-spacing: 0.544px;text-align: right;background-color: rgb(255, 255, 255);">来源:阿里巴巴中间件</span></p><hr style="border-style: solid;border- 1px 0 0;border-color: rgba(0,0,0,0.1);-webkit-transform-origin: 0 0;-webkit-transform: scale(1, 0.5);transform-origin: 0 0;transform: scale(1, 0.5);"><blockquote><p style="text-align: justify;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;text-align: justify;">技术传播的价值,不仅仅体现在通过商业化产品和开源项目来缩短我们构建应用的路径,加速业务的上线速率,</span><span style="background-color: rgb(255, 255, 255);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;text-align: justify;color: rgb(0, 122, 170);">也体现在优秀工程师在工作效率提升、产品性能优化和用户体验改善等经验方面的分享,以提高我们的专业能力。</span></p></blockquote><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">当我们想用一张或几张图来描述我们的系统时,是不是经常遇到以下情况:</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">对着画布无从下手、删了又来?</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">用一张图描述我的系统,并且让产品、运营、开发都能看明白?</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">画了一半的图还不清楚受众是谁?</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">画出来的图到底是产品图功能图还是技术图又或是大杂烩?</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">图上的框框有点少是不是要找点儿框框加进来?</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">布局怎么画都不满意……</span></p></li></ul><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">如果有同样的困惑,本文将介绍一种画图的方法论,来让架构图更清晰。</span></p><p><br></p><p><br></p><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;max- 100%;min-height: 1em;letter-spacing: 0.544px;white-space: normal;text-align: center;line-height: 1.5em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max- 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max- 100%;color: rgb(0, 122, 170);box-sizing: border-box !important;overflow-wrap: break-word !important;">先厘清一些基础概念</span></strong></p><hr style="max- 100%;letter-spacing: 0.544px;white-space: normal;border-style: solid;border-right- 0px;border-bottom- 0px;border-left- 0px;border-color: rgba(0, 0, 0, 0.1);transform-origin: 0px 0px 0px;transform: scale(1, 0.5);box-sizing: border-box !important;overflow-wrap: break-word !important;"><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;max- 100%;min-height: 1em;letter-spacing: 0.544px;white-space: normal;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><br style="max- 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"></p><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;max- 100%;min-height: 1em;letter-spacing: 0.544px;white-space: normal;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="color: rgb(0, 122, 170);">1、<span style="background-color: rgb(255, 255, 255);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">什么是架构</span></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">架构就是对系统中的实体以及实体之间的关系所进行的抽象描述,是一系列的决策。</span></p><p><br></p><p><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">架构是结构和愿景。</span><br></p><p><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><p><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">系统架构是概念的体现,是对物/信息的功能与形式元素之间的对应情况所做的分配,是对元素之间的关系以及元素同周边环境之间的关系所做的定义。</span><br></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">做好架构是个复杂的任务,也是个很大的话题,本篇就不做深入了。有了架构之后,就需要让干系人理解、遵循相关决策。</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">2、什么是架构图</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">系统架构图是为了抽象的表示软件系统的整体轮廓和各个组件之间的相互关系和约束边界,以及软件系统的物理部署和软件系统的演进方向的整体视图。</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">3、架构图的作用</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">一图胜千言。要让干系人理解、遵循架构决策,就需要把架构信息传递出去。架构图就是一个很好的载体。那么,画架构图是为了:</span></p><p><br></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">解决沟通障碍</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">达成共识</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">减少歧义</span></p></li></ul><p style="text-align: justify;line-height: 1.75em;"><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">4、架构图分类</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">搜集了很多资料,分类有很多,有一种比较流行的是4+1视图,分别为场景视图、逻辑视图、物理视图、处理流程视图和开发视图。</span></p><p><br></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">场景视图</span></p></li></ul><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">场景视图用于描述系统的参与者与功能用例间的关系,反映系统的最终需求和交互设计,通常由用例图表示。</span></p><p style="text-align: center;"><img class="" data-copyright="0" data-ratio="0.6508196721311476" data-s="300,640" data-type="png" data-w="1220" data-src="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWsamXzVLZJ8tU4pN53dQtsiaeIIPHGaXvxkE2LVLuWmh1yQB4oATJxFUkG1zNWZlb3Zq4qn3lpbPOg/640?wx_fmt=png" style=" 677px !important; height: auto !important; visibility: visible !important;" _width="677px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112134420032-946171091.png" crossorigin="anonymous" data-fail="0"></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">逻辑视图</span></p></li></ul><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">逻辑视图用于描述系统软件功能拆解后的组件关系,组件约束和边界,反映系统整体组成与系 统如何构建的过程,通常由UML的组件图和类图来表示。</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;"><br></span></p><p style="text-align: center;margin-left: 16px;margin-right: 16px;"><img class="" data-croporisrc="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWvcclOwGU9iajINwGlLEgic3lWEyrV8d0PfRiasibhPU8Isfzc0X6xl2CVy7zUFIXH7qJF8fg8buoCQSQ/?wx_fmt=png" data-cropx1="55.77491961414791" data-cropx2="1609.5048231511255" data-cropy1="0" data-cropy2="1144.7138263665595" data-ratio="0.73515625" data-s="300,640" data-type="jpeg" data-w="1280" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/qdzZBE73hWvcclOwGU9iajINwGlLEgic3lIVFpInibvbnGVibfHOzKaSnGGiajAEzZsRgYwDD45NEibGpnWLMZ1DxvYw/640?wx_fmt=jpeg" style=" 585px !important; height: auto !important; visibility: visible !important;" _width="585px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112134456281-34265463.png" crossorigin="anonymous" data-fail="0"></p><p style="text-align: center;margin-left: 16px;margin-right: 16px;"><br></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">物理视图</span></p></li></ul><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">物理视图用于描述系统软件到物理硬件的映射关系,反映出系统的组件是如何部署到一组可&nbsp; &nbsp; 计算机器节点上,用于指导软件系统的部署实施过程。</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;"><br></span></p><p style="text-align: center;margin-left: 16px;margin-right: 16px;"><img class="" data-copyright="0" data-cropselx1="0" data-cropselx2="622" data-cropsely1="0" data-cropsely2="338" data-ratio="0.9648648648648649" data-s="300,640" data-type="png" data-w="1480" data-src="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWvcclOwGU9iajINwGlLEgic3l39s1qEJboDCeqHqDcCibs7l4HWGpLicaOXn8XPE4UDibUrIiczJ8ibSiadJw/640?wx_fmt=png" style=" 622px !important; height: auto !important; visibility: visible !important;" _width="622px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112134516950-1000917286.png" crossorigin="anonymous" data-fail="0"></p><p><br></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">处理流程视图</span></p></li></ul><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">处理流程视图用于描述系统软件组件之间的通信时序,数据的输入输出,反映系统的功能流程 与数据流程,通常由时序图和流程图表示。</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;"><br></span></p><p style="text-align: center;margin-left: 16px;margin-right: 16px;"><img class="" data-croporisrc="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWvcclOwGU9iajINwGlLEgic3l3CAicQvJ1K7sqeuJambaR4YO6O8iadsrKMPh82LAda0m9jWZBqFxzhUw/?wx_fmt=png" data-cropx1="0" data-cropx2="1245.5726927939318" data-cropy1="46.058154235145395" data-cropy2="1065.345132743363" data-ratio="0.8184738955823293" data-s="300,640" data-type="jpeg" data-w="1245" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/qdzZBE73hWvcclOwGU9iajINwGlLEgic3luJ832iaC0K4LMCYicnslPZDguYtiajlJe1SLY9RXVP2YYiceUh2ZZerx2A/640?wx_fmt=jpeg" style=" 622px !important; height: auto !important; visibility: visible !important;" _width="622px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112134536596-752657978.png" crossorigin="anonymous" data-fail="0"></p><p><br></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">开发视图</span></p></li></ul><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">开发视图用于描述系统的模块划分和组成,以及细化到内部包的组成设计,服务于开发人员,反映系统开发实施过程。</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;"><br></span></p><p style="text-align: center;margin-left: 16px;margin-right: 16px;"><img class="" data-copyright="0" data-ratio="0.7178130511463845" data-s="300,640" data-type="png" data-w="1134" data-src="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWsamXzVLZJ8tU4pN53dQtsiajkZUCt04DmX8TCauiblAsXQjWuJPR6KSAJ6SGctIxe3drvMyeibxkjmA/640?wx_fmt=png" style=" 677px !important; height: auto !important; visibility: visible !important;" _width="677px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112134552285-1579426174.png" crossorigin="anonymous" data-fail="0"></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">以上 5 种架构视图从不同角度表示一个软件系统的不同特征,组合到一起作为架构蓝图描述系统架构。</span></p><p><br></p><p><br></p><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;white-space: normal;max- 100%;min-height: 1em;letter-spacing: 0.544px;text-align: center;line-height: 1.5em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max- 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max- 100%;color: rgb(0, 122, 170);box-sizing: border-box !important;overflow-wrap: break-word !important;">怎样的架构图是好的架构图</span></strong></p><hr style="white-space: normal;max- 100%;letter-spacing: 0.544px;border-style: solid;border-right- 0px;border-bottom- 0px;border-left- 0px;border-color: rgba(0, 0, 0, 0.1);transform-origin: 0px 0px 0px;transform: scale(1, 0.5);box-sizing: border-box !important;overflow-wrap: break-word !important;"><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;white-space: normal;max- 100%;min-height: 1em;letter-spacing: 0.544px;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><br style="max- 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"></p><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;white-space: normal;max- 100%;min-height: 1em;letter-spacing: 0.544px;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">上面的分类是前人的经验总结,图也是从网上摘来的,那么这些图画的好不好呢?是不是我们要依葫芦画瓢去画这样一些图?</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">先不去管这些图好不好,我们通过对这些图的分类以及作用,思考了一下,总结下来,我们认为,在画出一个好的架构图之前,</span><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);"> 首先应该要明确其受众,再想清楚要给他们传递什么信息 ,所以,不要为了画一个物理视图去画物理视图,为了画一个逻辑视图去画逻辑视图,而应该根据受众的不同,传递的信息的不同,用图准确地表达出来,最后的图可能就是在这样一些分类里。那么,画出的图好不好的一个直接标准就是:受众有没有准确接收到想传递的信息。</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">明确这两点之后,从受众角度来说,一个好的架构图是不需要解释的,它应该是自描述的,并且要具备一致性和足够的准确性,能够与代码相呼应。</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;white-space: normal;max- 100%;min-height: 1em;letter-spacing: 0.544px;text-align: center;line-height: 1.5em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><strong style="max- 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="max- 100%;color: rgb(0, 122, 170);box-sizing: border-box !important;overflow-wrap: break-word !important;">画架构图遇到的常见问题</span></strong></p><hr style="white-space: normal;max- 100%;letter-spacing: 0.544px;border-style: solid;border-right- 0px;border-bottom- 0px;border-left- 0px;border-color: rgba(0, 0, 0, 0.1);transform-origin: 0px 0px 0px;transform: scale(1, 0.5);box-sizing: border-box !important;overflow-wrap: break-word !important;"><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;white-space: normal;max- 100%;min-height: 1em;letter-spacing: 0.544px;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><br style="max- 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"></p><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;white-space: normal;max- 100%;min-height: 1em;letter-spacing: 0.544px;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="background-color: rgb(255, 255, 255);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;color: rgb(0, 122, 170);">1、方框代表什么?</span></p><p style="text-align: center;"><img class="" data-croporisrc="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWsamXzVLZJ8tU4pN53dQtsiac04qib4fdErF3TYnpTT9R5AbWRBB8ibk1sDn1NJ0mNpx02F3y6Sgbuyg/?wx_fmt=png" data-cropx1="0" data-cropx2="428" data-cropy1="75" data-cropy2="192" data-ratio="0.2757009345794392" data-s="300,640" data-type="jpeg" data-w="428" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/qdzZBE73hWsamXzVLZJ8tU4pN53dQtsiagfCichEfGibw1ZneEjZ8meS4ibWsUWrM4BOqJH2CyYLwduTgU9icjt9KfQ/640?wx_fmt=jpeg" style=" 428px !important; height: auto !important; visibility: visible !important;" _width="428px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112134611186-738989999.png" crossorigin="anonymous" data-fail="0"></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">为什么适用方框而不是圆形,它有什么特殊的含义吗?随意使用方框或者其它形状可能会引起混淆。</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">2、虚线、实线什么意思?箭头什么意思?颜色什么意思?</span></p><p style="text-align: center;margin-left: 0px;margin-right: 0px;"><img class="" data-copyright="0" data-ratio="0.2" data-s="300,640" data-type="png" data-w="1700" data-src="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWsamXzVLZJ8tU4pN53dQtsiam8BMWINLygHTH5r1hIW6HMww7fdCqo2mAX8ngEPC9QW5wp7ialSOllA/640?wx_fmt=png" style=" 677px !important; height: auto !important; visibility: visible !important;" _width="677px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112134648584-2092729824.png" crossorigin="anonymous" data-fail="0"></p><p><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">随意使用线条或者箭头可能会引起误会。</span><br></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">3、运行时与编译时冲突?层级冲突?</span></p><p style="text-align: justify;line-height: 1.75em;"><img class="" data-copyright="0" data-ratio="0.2" data-s="300,640" data-type="png" data-w="1700" data-src="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWsamXzVLZJ8tU4pN53dQtsiam8BMWINLygHTH5r1hIW6HMww7fdCqo2mAX8ngEPC9QW5wp7ialSOllA/640?wx_fmt=png" style="text-align: center; white-space: normal;  677px !important; height: auto !important; visibility: visible !important;" _width="677px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112134712717-1220099651.png" crossorigin="anonymous" data-fail="0"></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">架构是一项复杂的工作,只使用单个图表来表示架构很容易造成莫名其妙的语义混乱。</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;white-space: normal;max- 100%;min-height: 1em;letter-spacing: 0.544px;text-align: center;line-height: 1.5em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="color:#007aaa;"><strong>本文推荐的画图方法</strong></span></p><hr style="white-space: normal;max- 100%;letter-spacing: 0.544px;border-style: solid;border-right- 0px;border-bottom- 0px;border-left- 0px;border-color: rgba(0, 0, 0, 0.1);transform-origin: 0px 0px 0px;transform: scale(1, 0.5);box-sizing: border-box !important;overflow-wrap: break-word !important;"><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;white-space: normal;max- 100%;min-height: 1em;letter-spacing: 0.544px;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><br style="max- 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"></p><p style="text-align: center;"><img class="" data-copyright="0" data-ratio="0.5614457831325301" data-s="300,640" data-type="png" data-w="830" data-src="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWsamXzVLZJ8tU4pN53dQtsiaXhUFCINc4NgSrRctWUr1nuvcETdW5HPdlDibPMdedicoy4YX5jDeP31A/640?wx_fmt=png" style=" 677px !important; height: auto !important; visibility: visible !important;" _width="677px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112134733255-1474429191.png" crossorigin="anonymous" data-fail="0"></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">C4 模型使用容器(应用程序、数据存储、微服务等)、组件和代码来描述一个软件系统的静态结构。这几种图比较容易画,也给出了画图要点,但最关键的是,我们认为,它明确指出了每种图可能的受众以及意义。</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">下面的案例来自C4官网,然后加上了一些我们的理解,来看看如何更好的表达软件架构</span><br></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">1、语境图(System Context Diagram)</span></p><p style="text-align: justify;line-height: 1.75em;"><br></p><p style="text-align: center;"><br></p><p style="text-align: center;"><img class="img_loading" data-copyright="0" data-cropselx1="0" data-cropselx2="654" data-cropsely1="0" data-cropsely2="467" data-ratio="0.7947019867549668" data-s="300,640" data-type="png" data-w="906" data-src="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWsamXzVLZJ8tU4pN53dQtsiafhld70zIoyCLX9ibkEFxXI44HHiaQqf05ws8frqyeE6PByP1BRvxT4DA/640?wx_fmt=png" style=" 654px !important; height: 519.735px !important;" _width="654px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112135023775-390856057.png" crossorigin="anonymous"></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">这是一个想象的待建设的互联网银行系统,它使用外部的大型机银行系统存取客户账户、交易信息,通过外部电邮系统给客户发邮件。可以看到,非常简单、清晰,相信不需要解释,都看的明白,里面包含了需要建设的系统本身,系统的客户,和这个系统有交互的周边系统。</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(0, 122, 170);"><em><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);text-decoration: underline;">用途</span></em></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">这样一个简单的图,可以告诉我们,要构建的系统是什么;它的用户是谁,谁会用它,它要如何融入已有的IT环境。这个图的受众可以是开发团队的内部人员、外部的技术或非技术人员。即:</span></p><p><br></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">构建的系统是什么</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">谁会用它</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">如何融入已有的IT环境</span></p></li></ul><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;"><br></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(0, 122, 170);"><em><span style="color: rgb(0, 122, 170);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);text-decoration: underline;">怎么画</span></em></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">中间是自己的系统,周围是用户和其它与之相互作用的系统。这个图的关键就是梳理清楚待建设系统的用户和高层次的依赖,梳理清楚了画下来只需要几分钟时间。</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">2、容器图(Container Diagram)</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">容器图是把语境图里待建设的系统做了一个展开。</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><p style="text-align: center;"><img class="img_loading" data-croporisrc="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWvcclOwGU9iajINwGlLEgic3lvWjI0ltUxELIur4piaHDdgqDNSbiaxKk8gktWeTQLfp6Yb1JGoP83zyA/?wx_fmt=png" data-cropx1="0" data-cropx2="1616.8060150375939" data-cropy1="0" data-cropy2="1381.948872180451" data-ratio="0.8546875" data-s="300,640" data-type="jpeg" data-w="1280" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/qdzZBE73hWvcclOwGU9iajINwGlLEgic3lWVbHsIZx9HXxBicnJLGMJth0FiaoCNsItHRj9WVcMSTibp0tdYgJK3HXg/640?wx_fmt=jpeg" style="text-align: center; white-space: normal;  654px !important; height: 558.966px !important;" _width="654px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112135056177-1376602424.png" crossorigin="anonymous"></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">上图中,除了用户和外围系统,要建设的系统包括一个基于javaspring mvc的web应用提供系统的功能入口,基于xamarin架构的手机app提供手机端的功能入口,一个基于java的api应用提供服务,一个mysql数据库用于存储,</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">各个应用之间的交互都在箭头线上写明了。</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">看这张图的时候,不会去关注到图中是直角方框还是圆角方框,不会关注是实线箭头还是虚线箭头,甚至箭头的指向也没有引起太多注意。</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">我们有许多的画图方式,都对框、线的含义做了定义,这就需要画图的人和看图的人都清晰的理解这些定义,才能读全图里的信息,而现实是,这往往是非常高的一个要求,所以,很多图只能看个大概的含义。</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><em><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);text-decoration: underline;">用途</span></em></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">这个图的受众可以是团队内部或外部的开发人员,也可以是运维人员。用途可以罗列为:</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">展现了软件系统的整体形态</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">体现了高层次的技术决策</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">系统中的职责是如何分布的,容器间的是如何交互的</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">告诉开发者在哪里写代码</span></p></li></ul><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="text-decoration: underline;"><em><span style="text-decoration: underline;font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">怎么画</span></em></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">用一个框图来表示,内部可能包括名称、技术选择、职责,以及这些框图之间的交互,如果涉及外部系统,最好明确边界。</span></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);">3、组件图(Component Diagram)</span></p><p style="text-align: center;"><img class="img_loading" data-copyright="0" data-ratio="0.964095744680851" data-s="300,640" data-type="png" data-w="752" data-src="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWsamXzVLZJ8tU4pN53dQtsiaU8rRbTxaAlTD3TjIQKt2WzMYs8NePmvcVECwHrwpM32nBlRapK0S3A/640?wx_fmt=png" style=" 677px !important; height: 652.693px !important;" _width="677px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112135117309-1576475810.png" crossorigin="anonymous"></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">组件图是把某个容器进行展开,描述其内部的模块。</span><br></p><p><br></p><p style="text-align: justify;line-height: 1.75em;"><em><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);color: rgb(0, 122, 170);text-decoration: underline;">用途</span></em></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">这个图主要是给内部开发人员看的,怎么去做代码的组织和构建。其用途有:</span></p><p><br></p><ul class="list-paddingleft-2" style="list-style-type: disc;"><li><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">描述了系统由哪些组件/服务组成</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">厘清了组件之间的关系和依赖</span></p></li><li><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">为软件开发如何分解交付提供了框架</span></p></li></ul><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;"><br></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="background-color: rgb(255, 255, 255);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;color: rgb(0, 122, 170);">4、类图(Code/Class Diagram)</span></p><p style="text-align: center;"><img class="img_loading" data-copyright="0" data-ratio="0.7035647279549718" data-s="300,640" data-type="png" data-w="1066" data-src="https://mmbiz.qpic.cn/mmbiz_png/qdzZBE73hWsamXzVLZJ8tU4pN53dQtsia0nPE0Iiavs9ecEeO3vSCjWXvUEJhGncW4fIOZ8sicFkZPaTKYOViafebA/640?wx_fmt=png" style=" 677px !important; height: 476.313px !important;" _width="677px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112135142467-1677698939.png" crossorigin="anonymous"></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">这个图很显然是给技术人员看的,比较常见,就不详细介绍了。</span></p><p><br></p><p><br></p><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;white-space: normal;max- 100%;min-height: 1em;letter-spacing: 0.544px;text-align: center;line-height: 1.5em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="color: rgb(0, 122, 170);"><strong>案例分享</strong></span></p><hr style="white-space: normal;max- 100%;letter-spacing: 0.544px;border-style: solid;border-right- 0px;border-bottom- 0px;border-left- 0px;border-color: rgba(0, 0, 0, 0.1);transform-origin: 0px 0px 0px;transform: scale(1, 0.5);box-sizing: border-box !important;overflow-wrap: break-word !important;"><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;white-space: normal;max- 100%;min-height: 1em;letter-spacing: 0.544px;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><br style="max- 100%;box-sizing: border-box !important;overflow-wrap: break-word !important;"></p><p dir="ltr" style="margin-top: 0pt;margin-bottom: 0pt;white-space: normal;max- 100%;min-height: 1em;letter-spacing: 0.544px;line-height: 2em;box-sizing: border-box !important;overflow-wrap: break-word !important;"><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;">下面是内部的一个实时数据工具的架构图。作为一个应该自描述的架构图,这里不多做解释了。如果有看不明白的,那肯定是还画的不够好。</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><img class="img_loading" data-copyright="0" data-cropselx1="0" data-cropselx2="654" data-cropsely1="0" data-cropsely2="467" data-ratio="0.72890625" data-s="300,640" data-type="jpeg" data-w="1280" data-src="https://mmbiz.qpic.cn/mmbiz_jpg/qdzZBE73hWvcclOwGU9iajINwGlLEgic3l7egzz3TJRf7n7CSy1TiceFC9H21Ziar9l1iasabhIM8ibc9yH4GQjPgxfw/640?wx_fmt=jpeg" style="text-align: center; white-space: normal;  654px !important; height: 476.705px !important;" _width="654px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112135210029-1561252980.png" crossorigin="anonymous"></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">画好架构图可能有许多方法论,本篇主要介绍了C4这种方法,C4的理论也是不断进化的。但不论是哪种画图方法论,我们回到画图初衷,更好的交流,我们在画的过程中不必被条条框框所限制。简而言之,画之前想好:画图给谁看,看什么,怎么样不解释就看懂。</span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"><br></span></p><p style="text-align: justify;line-height: 1.75em;"><span style="color: rgb(0, 122, 170);"><em><span style="font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);">参考资料:</span></em></span></p><p><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);font-size: 13px;">C4官网:</span></p><p><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);font-size: 13px;">https://c4model.com/</span></p><p style="text-align: justify;line-height: 1.75em;"><br></p><p><span style="background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;letter-spacing: 0.544px;white-space: pre-line;font-size: 13px;">为什么需要软件架构图:</span><br></p><p><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);font-size: 13px;">https://www.infoq.cn/article/GhprrUlOYyOqS8*FR1pH</span></p><p><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);font-size: 13px;">书籍:《程序员必读之软件架构》</span><span style="color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;letter-spacing: 0.544px;white-space: pre-line;background-color: rgb(255, 255, 255);"></span></p><p style="text-align: justify;line-height: 1.75em;"><br></p><blockquote><p style="text-align: justify;line-height: 1.75em;"><span style="max- 100%;letter-spacing: 0.544px;background-color: rgb(255, 255, 255);color: rgb(74, 74, 74);font-family: Avenir, -apple-system-font, 微软雅黑, sans-serif;font-size: 15px;white-space: pre-line;box-sizing: border-box !important;overflow-wrap: break-word !important;">本文作者:三画,阿里巴巴技术专家。曾多年从事工作流引擎研发工作,现专注于高并发移动互联网应用的架构和开发,和本文贡献者均来自阿里巴巴零售通部门。</span></p></blockquote><section class="" mpa-from-tpl="t"><section data-mpa-template="t" class="" mpa-from-tpl="t"><pre style="color: inherit;font-size: inherit;text-align: justify;letter-spacing: 0.544px;caret-color: rgb(51, 51, 51);text-size-adjust: auto;line-height: inherit;"><section class="" powered-by="xiumi.us" style="letter-spacing: 0.544px;white-space: normal;" mpa-from-tpl="t"><section class="" mpa-from-tpl="t"><section class="" mpa-from-tpl="t"><section class="" mpa-from-tpl="t"><section class="" data-tools="135编辑器" data-id="89428" mpa-from-tpl="t"></section></section></section></section></section><section class="" style="letter-spacing: 0.544px;white-space: normal;" mpa-from-tpl="t"><section class="" mpa-from-tpl="t"><section class="" mpa-from-tpl="t"></section></section></section></pre></section></section><p style="margin-bottom: 5px;font-family: -apple-system-font, BlinkMacSystemFont, &quot;Helvetica Neue&quot;, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei UI&quot;, &quot;Microsoft YaHei&quot;, Arial, sans-serif;letter-spacing: 0.544px;white-space: normal;color: rgb(62, 62, 62);widows: 1;background-color: rgb(255, 255, 255);font-size: 15px;word-spacing: 2px;text-align: right;line-height: normal;"><span style="color: rgb(171, 25, 66);"><strong><span style="font-size: 12px;"><strong style="letter-spacing: 0.544px;">明天见</strong></span></strong></span><img class="" data-ratio="0.8936170212765957" data-type="png" data-w="47" data-src="https://mmbiz.qpic.cn/mmbiz_png/Pn4Sm0RsAuhpplm16ibb8iaib7RoGQ5iaHEdvAd0o9e1LlUGA2k0Yib222agOxzweXhahA9GuzJcGBg0dA4DzlibxRqw/640?wx_fmt=png" style="margin-bottom: -6px; color: rgb(86, 146, 214); font-family: monospace; letter-spacing: 1.5px; text-align: center; font-size: 17px; visibility: visible !important;  20px !important; height: 17.8723px !important;" _width="20px" src="https://img2018.cnblogs.com/blog/1112483/201911/1112483-20191112135234570-1670833589.png" crossorigin="anonymous"></p>
   原文地址:https://mp.weixin.qq.com/s/vd0q9vk6aNjxCQ07h8NzLQ         </div>
原文地址:https://www.cnblogs.com/jpfss/p/11841331.html