“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.
其他回答
Yes my dear friends said correctly. Layer is a logical partition of application whereas tier is physical partition of system tier partition is depends on layer partition. Just like an application execute on single machine but it follows 3 layered architecture, so we can say that layer architecture could be exist in a tier architecture. In simple term 3 layer architecture can implement in single machine then we can say that its is 1 tier architecture. If we implement each layer on separate machine then its called 3 tier architecture. A layer may also able to run several tier. In layer architecture related component to communicate to each other easily. Just like we follow given below architecture
表示层 业务逻辑层 数据访问层
客户端可以与“表示层”进行交互,但出于安全考虑,客户端可以访问“业务逻辑层”下一层的公共组件(如业务逻辑层的公共组件)。 问:为什么我们使用层结构? 因为如果我们实现了层结构,我们就能提高应用程序的效率
= = >安全
= = >可管理性
= = >可伸缩性
其他需求,如开发应用程序后,我们需要改变DBMS或修改业务逻辑等,那么这是必要的。
问:为什么我们要使用分层架构?
因为每一层的物理实现都提供了更好的效率,没有层架构我们就无法实现层架构。分离机实现分离 层和分离层是实现一个或多个层这就是我们使用它的原因。 它用于容错目的。 ==>易于维护。
简单的例子
就像银行开在一个房间里,员工在里面分类:
门房 现金的人 负责介绍银行方案的人 经理
它们都是系统的相关组件。
如果我们去银行贷款,首先是一个门卫微笑着开门 之后我们就去就近介绍所有贷款方案的人 我们去经理小屋,通过贷款。 在那之后,最后我们去收银台贷款。 这些是银行的层结构。
层级呢? 一家银行的分行开在一个城镇,接着又开在另一个城镇,接着又开在另一个城镇 但是每个分支的基本要求是什么呢
门房 现金的人 负责介绍银行方案的人 经理
层和层的概念完全一样。
我使用层来描述我的解决方案组件中的架构师或技术堆栈。通常在涉及网络或进程间通信时,我使用层对这些组件进行逻辑分组。
为什么总想用复杂的词?
一层=你的代码的一部分,如果你的应用程序是一个蛋糕,这是一片。
一层=一台物理机器,一台服务器。
一个层承载一个或多个层。
层的例子:
表示层=通常是所有与用户界面相关的代码 数据访问层=与数据库访问相关的所有代码
层:
你的代码托管在服务器上=你的代码托管在一个层上。
你的代码托管在2个服务器上=你的代码托管在2层上。
例如,一台机器承载Web站点本身(表示层),另一台机器更安全地承载所有更安全的代码(真正的业务代码-业务层、数据库访问层等)。
实现分层架构有很多好处。这很棘手,正确实现分层应用程序需要时间。如果你有一些,看看微软的这篇文章:http://msdn.microsoft.com/en-gb/library/ee658109.aspx
从技术上讲,Tier可以是代码运行所需的一种最小环境。
例如,假设一个3层应用程序可以运行
3 physical machines with no OS . 1 physical machine with 3 virtual machines with no OS. (That was a 3-(hardware)tier app) 1 physical machine with 3 virtual machines with 3 different/same OSes (That was a 3-(OS)tier app) 1 physical machine with 1 virtual machine with 1 OS but 3 AppServers (That was a 3-(AppServer)tier app) 1 physical machine with 1 virtual machine with 1 OS with 1 AppServer but 3 DBMS (That was a 3-(DBMS)tier app) 1 physical machine with 1 virtual machine with 1 OS with 1 AppServers and 1 DBMS but 3 Excel workbooks. (That was a 3-(AppServer)tier app)
Excel工作簿是运行VBA代码所需的最低环境。
这3个工作簿可以放在一台物理计算机上,也可以放在多个物理计算机上。
我注意到,在实践中,人们在应用描述上下文中说“层”时,指的是“操作系统层”。
也就是说,如果一个应用运行在3个不同的操作系统上,那么它就是一个3层应用。
所以从学究角度来说,描述应用程序的正确方法是
“1至3层能力,运行在2层”应用程序。
:)
层只是应用程序中职责功能分离的代码类型(例如,表示,数据,安全等)。
当你谈论表示、服务、数据、网络层时,你是在谈论层。 当你“分别部署它们”时,你谈论的是层。
Tiers是关于部署的。 这样说吧:我们有一个应用程序,它有一个用Angular创建的前端,它有一个像MongoDB一样的后端,还有一个在前端和后端之间交互的中间层。因此,当前端应用程序、数据库应用程序和中间层都单独部署时,我们称其为3层应用程序。
好处:如果我们将来需要扩展后端,我们只需要独立地扩展后端,而不需要扩展前端。
推荐文章
- Symfony 2.x中的所有东西都应该捆绑吗?
- 用Python构建最小的插件架构
- 单页应用:优点和缺点
- 由Jon Skeet撰写的《Singleton》澄清
- 跨REST微服务的事务?
- 为什么Linux被称为单片内核?
- 你如何设计面向对象的项目?
- “Layers”和“Tiers”的区别是什么?
- 一般来说,在一个组件中使用一个还是多个useEffect钩子更好?
- 何时以及如何在微服务架构中使用GraphQL
- 服务应该总是返回dto,还是也可以返回域模型?
- “协程”和“线程”之间的区别?
- 当Node.js内部仍然依赖线程时,它是如何固有地更快的?
- 允许PHP应用程序使用插件的最佳方法
- 会话锁导致ASP。网络网站速度慢