使用存储过程作为业务逻辑层 [英] Using Stored Procedures as the Business Logic Layer

查看:36
本文介绍了使用存储过程作为业务逻辑层的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的公司目前使用存储过程(在 MsSQL 服务器后端)作为他们的业务逻辑层.实际的业务逻辑 DLL 只是调用 sProcs 并基本上管理 UI(事件、数据绑定等)

The company I'm working for is currently using Stored Procedures (in the MsSQL server backend) as their Business Logic Layer. The actual Business Logic DLL just calls the sProcs and basically manages the UI (events, data binding, etc.)

我认为设置有问题,但我不确定如何向我的同事解释.顺便说一句,系统可以工作.

I think there's something wrong in the setup, although I'm not sure how to explain it to my colleagues. Btw, the system works.

我工作场所的最佳实践"有错吗?还是我想多了?

Is the "Best Practices" in my workplace wrong? Or am I just overthinking this?

推荐答案

GaiusSensei - 只要业务领域能够处理业务实践中的巨大变化,以这种方式工作就完全没问题.我认为 SP 和 BLL dll 之间的争论仍然很普遍,毫无疑问,这个话题双方都会有很多争论.但是,根据我自己过去 10 年在一系列项目中的经验,以下是我支持 BLL dll 方法的观察结果:

GaiusSensei - it's perfectly fine to work in that way as long as the business domain is able to handle seismic shifts in business practices. i think the debate is still rife between SP's and BLL dll's and no doubt, there will be plenty on both sides in this thread. However, from my own experience over a range of projects in the past 10 years, here are my observations supporting the BLL dll approach:

  • 包含在 BLL 中的逻辑可以是不可知"的存储介质和因此更灵活地改变(这种情况发生的频率是有争议)
  • 对业务进行更细粒度的控制权限范围依赖的应用程序数据存储.我的意思是核心其完整性必须是表维持在特定的水平它在业务中使用有问题的应用程序.
  • BLL 逻辑可以封装在 self包含可以重用的类在其他业务领域和或项目.班级甚至可以写成密封类或可扩展取决于您的目标'观众'
  • 单元测试 - 这(在我的经验)是一种黑色艺术,如果使用SP里面.在 java/c# 等下,这个是一个标准,有些人会说现在强制练习.
  • 可维护性.通过保持良好BLL dll 中的有组织的接口场景,你可以很容易地支持开发人员扩展您的不破坏现有的类逻辑
  • 便携性.您的 BLL(取决于语言实现)可以是托管在各种平台上.同样,注入数据存储的实现可以从字面上看是来自 xml 的任何东西文件到 mysql、mssql postgres 等,等
  • 标准化.数据架构师可以准确定义每个数据元素应该取自数据库以及每个项目应该如何保存(这会更好地位于 DAL dll 中).因此,进入成本新开发人员以及经验丰富的,对项目的影响很大减少.

列表还在继续,但这些是我采用 BLL 方法的首要优点.

The list goes on but, these are my top of the head PROS for adopting a BLL approach.

期待这个游戏的许多旋转:)

Looking fwd to the many spins on this one :)

吉姆

- 我还要补充一点,这个 BLL 也不应该发出任何 UI 信息,除了(正如你提到的)传达事件等.每个 UI 层(与目标设备相关 - 浏览器/移动设备/factory) 应该引用 BLL 并用数据做它自己的thang".我还要补充一点,BLL 下方将是您的 DAL 层.该层可以被视为与底层数据存储的 1-1 引用.

[edit] - i'd also add that this BLL should NOT emit any UI information either, other than (as you mention) to convey events etc. each UI layer (relevant to the target device -browser/mobile device/factory) should reference the BLL and do it's own 'thang' with the data. I'd further add that below the BLL would be your DAL layer. this layer could be considered a 1-1 reference with the underlying datastore.

这篇关于使用存储过程作为业务逻辑层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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