为什么我们使用业务层,同时又可以在表示层上编写业务逻辑 [英] why we are using business layer while we can write business logic on presentation layer

查看:105
本文介绍了为什么我们使用业务层,同时又可以在表示层上编写业务逻辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


请说明为什么要使用业务层,同时我们也可以在表示层上编写业务逻辑,以及三层体系结构的实际用途是什么.




谢谢

解决方案

它不是真正的解决方案,而是链接....

http://en.wikipedia.org/wiki/Multitier_architecture [ 解决方案

Its not really a solution, but a link....

http://en.wikipedia.org/wiki/Multitier_architecture[^]


If your application contains less business logic, then IMHO, I agree you can put it on your presentation layer. But if you are designing a complex system that contains many business logic, then I guess you need to separate it to a different tier. The purpose of BLL is self explanatory. One main purpose for this is for validating the correctness of your data before inserting it to your database.


The problem with intertwining UI behaviour with business logic is that you make testing your business logic that much more complicated. If you are developing a one-off small scale system then you may feel that going the extra mile to layer your application just isn''t worth the effort, and that''s fine.

But, if your application is going to be something complex that takes a while to develop then you really should consider how you are going to test your code, and having tests that can run automatically is a good way to help make your application more robust (providing you apply a rigid development discipline).

The bottom line is, do you consider yourself a professional intent on delivering quality applications to your clients, or do you just write small apps for fun where maintainability and enhancement isn''t that important?


这篇关于为什么我们使用业务层,同时又可以在表示层上编写业务逻辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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