1. Layered Architecture
分层架构
1.1 Clean Onion
洋葱架构
将应用程序分成多个层次,每一层都有自己的职责和特殊的关注点,这些层次按照一定规则组织起来,形成一个类似于洋葱的结构,每个层次都只能依赖于它内部的层次,而不依赖于外部的层次,实现了高内聚、低耦合的设计目标。
场景:通用
<div data-t="flow" data-processon-v="{"list":[{"parent":"","link":"","shapeStyle":{"alpha":1},"textBlock":[],"anchors":[{"x":"w/2","y":"0"},{"x":"w/2","y":"h"},{"x":"0","y":"h/2"},{"x":"w","y":"h/2"}],"title":"","fontStyle":{},"dataAttributes":[],"props":{"zindex":1,"w":665,"x":48,"h":488,"y":41,"angle":0},"path":[{"lineStyle":{"lineWidth":0},"actions":[{"x":"0","action":"move","y":"0"},{"x":"w","action":"line","y":"0"},{"x":"w","action":"line","y":"h"},{"x":"0","action":"line","y":"h"},{"action":"close"}]}],"lineStyle":{},"children":[],"resizeDir":["tl","tr","br","bl","l","t","r","b"],"name":"standardImage","fillStyle":{"imageW":828,"display":"stretch","imageH":577,"type":"image","fileId":"https://cdn.processon.com/userId2-64e5df4686c5204b81967aa9?e=1692790102&token=trhI0BY8QfVrIGn9nENop6JAc6l5nZuxhjQ62UfM:dW3kvW3FW8N4ia09kwiPfoH0zB0="},"theme":{},"id":"gBdWhPowZa768764","attribute":{"container":false,"rotatable":true,"visible":false,"fixedLink":false,"collapsable":false,"collapsed":false,"linkable":true,"markerOffset":5},"category":"standard","locked":false,"group":""}],"client":"1702461802988sMnuZdgvfm990253"}"></div><div data-t="flow" data-processon-v="{"list":[{"parent":"","link":"","shapeStyle":{"alpha":1},"textBlock":[],"anchors":[{"x":"w/2","y":"0"},{"x":"w/2","y":"h"},{"x":"0","y":"h/2"},{"x":"w","y":"h/2"}],"title":"","fontStyle":{},"dataAttributes":[],"props":{"zindex":1,"w":665,"x":48,"h":488,"y":41,"angle":0},"path":[{"lineStyle":{"lineWidth":0},"actions":[{"x":"0","action":"move","y":"0"},{"x":"w","action":"line","y":"0"},{"x":"w","action":"line","y":"h"},{"x":"0","action":"line","y":"h"},{"action":"close"}]}],"lineStyle":{},"children":[],"resizeDir":["tl","tr","br","bl","l","t","r","b"],"name":"standardImage","fillStyle":{"imageW":828,"display":"stretch","imageH":577,"type":"image","fileId":"https://cdn.processon.com/userId2-64e5df4686c5204b81967aa9?e=1692790102&token=trhI0BY8QfVrIGn9nENop6JAc6l5nZuxhjQ62UfM:dW3kvW3FW8N4ia09kwiPfoH0zB0="},"theme":{},"id":"gBdWhPowZa768764","attribute":{"container":false,"rotatable":true,"visible":false,"fixedLink":false,"collapsable":false,"collapsed":false,"linkable":true,"markerOffset":5},"category":"standard","locked":false,"group":""}],"client":"1702461802988sMnuZdgvfm990253"}"></div>
1.2 Layered (n-tier)
N层架构
Java EE应用经常采用的标准模式,将软件按照逻辑层次划分,通常分为业务层、数据层等。
每层都着特定的角色和职能,只能与位于下方的层发生耦合;
场景:通用,适合传统的IT通信和组织结构