“Layers”和“Tiers”的区别是什么?


当前回答

我发现一个定义说,层是逻辑分离,层是物理分离。

其他回答

当你谈论表示、服务、数据、网络层时,你是在谈论层。 当你“分别部署它们”时,你谈论的是层。

Tiers是关于部署的。 这样说吧:我们有一个应用程序,它有一个用Angular创建的前端,它有一个像MongoDB一样的后端,还有一个在前端和后端之间交互的中间层。因此,当前端应用程序、数据库应用程序和中间层都单独部署时,我们称其为3层应用程序。

好处:如果我们将来需要扩展后端,我们只需要独立地扩展后端,而不需要扩展前端。

我发现一个定义说,层是逻辑分离,层是物理分离。

我使用层来描述我的解决方案组件中的架构师或技术堆栈。通常在涉及网络或进程间通信时,我使用层对这些组件进行逻辑分组。

我喜欢下面来自微软应用程序架构指南2的描述

层描述了应用程序中功能和组件的逻辑分组;而层描述了功能和组件在独立服务器、计算机、网络或远程位置上的物理分布。尽管层和层使用相同的名称集(表示、业务、服务和数据),但请记住,只有层意味着物理分离。

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.