“Layers”和“Tiers”的区别是什么?
当前回答
我发现一个定义说,层是逻辑分离,层是物理分离。
其他回答
我使用层来描述我的解决方案组件中的架构师或技术堆栈。通常在涉及网络或进程间通信时,我使用层对这些组件进行逻辑分组。
IBM的三层体系结构文章有一个章节专门讨论这个主题:
In discussions of three-tier architecture, layer is often used interchangeably – and mistakenly – for tier, as in 'presentation layer' or 'business logic layer.' They aren't the same. A 'layer' refers to a functional division of the software, but a 'tier' refers to a functional division of the software that runs on infrastructure separate from the other divisions. The Contacts app on your phone, for example, is a three-layer application, but a single-tier application, because all three layers run on your phone. The difference is important, because layers can't offer the same benefits as tiers.
阅读Scott Hanselman关于这个问题的帖子:关于“三/多层/层架构/设计”的提醒:
请记住,在“Scott的世界”(希望也是你的世界:)中,“Tier”是一个部署单元,而“Layer”是代码中责任的逻辑分离。你可能会说你有一个“三层”系统,但在一台笔记本电脑上运行它。你可能会说你有一个“三层”系统,但只有ASP。与数据库对话的NET页。精准就是力量,朋友们。
我喜欢下面来自微软应用程序架构指南2的描述
层描述了应用程序中功能和组件的逻辑分组;而层描述了功能和组件在独立服务器、计算机、网络或远程位置上的物理分布。尽管层和层使用相同的名称集(表示、业务、服务和数据),但请记住,只有层意味着物理分离。
Logical layers are merely a way of organizing your code. Typical layers include Presentation, Business and Data – the same as the traditional 3-tier model. But when we’re talking about layers, we’re only talking about logical organization of code. In no way is it implied that these layers might run on different computers or in different processes on a single computer or even in a single process on a single computer. All we are doing is discussing a way of organizing a code into a set of layers defined by specific function. Physical tiers however, are only about where the code runs. Specifically, tiers are places where layers are deployed and where layers run. In other words, tiers are the physical deployment of layers.
来源:Rockford Lhotka,所有应用程序都应该是n层吗?