两层体系结构和三层体系结构有什么区别? [英] what is difference between Two-Tier and Three-Tier Architecture?

查看:663
本文介绍了两层体系结构和三层体系结构有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Web应用程序,但首先我想知道哪种体系结构最好是3层或2层

I am developing a web application but first i wants to know which architecture is best 3 tier or two tier

推荐答案

您好,

到现在为止,您将不会看到太大的差异.创建多层就像为负载平衡而分离代码或使代码可维护一样.

如果您正在运行具有单个条目表格的小型项目,则可能会发现3Tier架构更加复杂,但是当您使用带有验证/安全性的复杂解决方案时,会发现它非常有用.

有时人们习惯称其为NTier架构,这意味着他们将自己的代码分成多个轮胎来执行多个任务.

因此,取决于您如何维护代码,在UserInterface和DataAccess之间使用业务层是可选的.

希望你有个好主意.
Hi,

As of now you will not see much difference. Creating multiple layers is like seprating your code for load balancing or making your code maintainable.

If you are running small project with single entry form, you may find 3Tier architecture more complicated but when you go for the complicated solution with validation/Security you found it very helpful.

Sometimes people used to call NTier architecture, it means they divide thier code in multiple tire to perform multiple task.

So Using Business layer in between UserInterface and DataAccess is optional depending upon how you are maintaining your code.

Hope you got some idea.


你好,

很抱歉让您失望,但我相信S.A. Kryukov想要说的是正确的.

2层和3层体系结构之间的主要区别在于,后者将其业务逻辑清楚地提取到中间层中.通过这种方式,对UI的依赖关系得以最小化.

但是您不能说一个比另一个更好(根据您的问题,什么是最好的"),原因是,这完全取决于您要开发的应用程序的复杂性.

我将尝试用一个例子来解释它.想象一下,您正在为某公司开发一个完整的基于Web的解决方案.我们可以认为该系统有些庞大,复杂,并且经常更改/更新.现在,这是3层体系结构派上用场的地方.您可以轻松地进行更改.但是您应该记住,在这种情况下,基于复杂性,您可能会选择4层,5层(n层体系结构).这些层也可以是物理层或逻辑层.
但是,假设您正在开发一个网站以进行作业.在3层或n层体系结构中做到这一点真是太棒了,但是您所要做的只是引入不必要的复杂性.

存在这些设计准则/模式是有原因的. IE.帮助您创建健壮的应用程序/网站/组件.不创建最佳应用程序.您必须根据自己的需求(而不是相反)来决定要使用哪些设计准则/模式.您必须应用这些准则来消除现有的瓶颈或预见的适用瓶颈.因此,没有最好的架构.希望我对你有意义.

希望对您有所帮助
Hi there,

I am sorry to disappoint you but I believe what S.A.Kryukov is trying to say is correct.

The main difference between the 2-tier and 3-tier architectures is that, the the latter has a clear extraction of it''s business logic into an intermediate layer. This way, the dependency to UI is minimized.

But you cannot say one is better than the other (as per your question, ''what is the best'') due to the reason that, it all depends on the complexity of the application you want to develop.

I''ll try to explain it with an example. Let''s imagine, you are developing a complete web based solution for a certain company. We can consider this system to be somewhat large, complex and is subject to changes/updates frequently. Now this is where the 3-tier architecture comes handy. You can change things easily. But you should remember that, in this scenario based on the complexity, you might go for 4-tier, 5-tier (n-tier architecture). These tiers might be physical or logical as well.
But imagine you are developing a website for an assignment. It''s awesome to do that in a 3-tier or n-tier architecture but all you are doing is introducing a unnecessary level of complexity.

These design guidelines/patterns exist for a reason. I.e. to help you create robust applications/websites/components. Not to create the best applications. You have to decide what design guidelines/patterns to use based on your requirement, not the other way around. You have to apply these guidelines to get rid of an existing bottleneck or an applicable bottleneck foreseen. So there is no best architecture; I hope I made sense to you.

Hope this helps, regards


这篇关于两层体系结构和三层体系结构有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆