讨论三层的好处,三层是否必要,请不惜口水!===&_&

foxe 2003-09-15 12:44:57
大家都说三层的话是不在客户端写SQL的,那从客户端传SQL和应用服务器中用SQL返回数据集有什么区别,好处在哪儿?
三层是不是必要
两层是仅仅是减轻数据服务器的负担而存在?
请大家讨论看看,请我能了解究竟何时怎样最好!
...全文
80 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
猛禽 2003-09-17
  • 打赏
  • 举报
回复
看具体应用的需要,三层的好处基本上就是BORLAND在MIDAS的帮助里说的那几点。

The advantages of this multi-tiered model include the following:

Encapsulation of business logic in a shared middle tier. Different client applications all access the same middle tier. This allows you to avoid the redundancy (and maintenance cost) of duplicating your business rules for each separate client application.
Thin client applications. Your client applications can be written to make a small footprint by delegating more of the processing to middle tiers. Not only are client applications smaller, but they are easier to deploy because they don’t need to worry about installing, configuring, and maintaining the database connectivity software (such as the Borland Database Engine and the database server’s client-side software). Thin client applications can be distributed over the Internet for additional flexibility.

Distributed data processing. Distributing the work of an application over several machines can improve performance because of load balancing, and allow redundant systems to take over when a server goes down.
Increased opportunity for security. You can isolate sensitive functionality into tiers that have different access restrictions. This provides flexible and configurable levels of security. Middle tiers can limit the entry points to sensitive material, allowing you to control access more easily. If you are using HTTP or COM+, you can take advantage of the security models they support.
hiflower 2003-09-15
  • 打赏
  • 举报
回复
加中间层,是为了实现业务规则。
如果在客户端使用 SQL,那么与C/S 没有多大区别,成了形式上的三层。中间层将很难处理客户端提交的 SQL 语句,也就难以控制业务规则。

但是毕竟客户端使用 SQL 是很有灵活性的,所以到底用三层还是用两层,是值得考虑的。或者在三层中有限地使用 SQL,这就需要设计时多加注意了。

hiflower 2003-09-15
  • 打赏
  • 举报
回复
假定向一个表插入一条记录,要影响到多个表。
在 C/S 方式时,你可以在客户端或数据库服务器上来实现对其它表的影响,这成为 胖客户机 或 胖服务器。
有了中间层,就可以在中间层来实现。
孰优孰劣,各人见解不同
foxe 2003-09-15
  • 打赏
  • 举报
回复
了解!那如果是两层,分布在三台机器上:
1台DB Server
1台Application Server
1台Client
那这样的格局上Application Server承担那些事务,可以减轻DB Server的负担?
同Client直接连DB Server有何区别,有什么利弊?
  • 打赏
  • 举报
回复
能用两层就用两层的。为三层而三层真是没有必要的。
业务规则说白了就是中间层的模块设计和函数方法设计,比如一个插入订单信息的模块。
foxe 2003-09-15
  • 打赏
  • 举报
回复
感谢,业务规则,能否举个事例!现在被这些东西搞得有点儿混!
foxe 2003-09-15
  • 打赏
  • 举报
回复
感谢,业务规则,能否举个事例!现在被这些东西搞得有点儿混!

1,178

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 数据库及相关技术
社区管理员
  • 数据库及相关技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧