应用程序设计-可修改的业务规则
我正在寻找有关应用程序设计的一些建议。由于我已签署保密协议,因此我无法透露太多有关实际业务的信息,但会尽力解释要求。
本质上,我们希望开发一个根据客户信用状况做出决定的应用程序。我们将从合适的提供商(例如 Experian)获取数据,并将其与业务规则进行匹配。如果客户满足这些规则,他们就会得到一个绿旗,可以传递到下一个流程(可能还有另一个系统,但目前不担心这个);如果没有,他们将收到危险信号并且不会被传递。
客户表示他们希望业务规则是可修改的,即他们可以修改的东西,而不是硬编码或卡在代码中的某个地方。他们定义了一组规则作为“模板”。系统一次只有一个活动模板,但在其生命周期内可能有许多模板。
这些规则将由检查不同数据类型的多个运算符组成。规则的每个阶段/步骤都将分配一定的权重。 “模板”的示例如下:
- 客户是否为男性 = 10 分
客户是否为女性 = 20 分
客户是否在 25 岁至 35 岁之间? = 20 分
客户年龄是否小于 25 岁? = 10 分
客户每年的收入是否在 $30000 到 $50000 之间 = 20 分
正如您所看到的,有各种类型的比较/运算符(布尔值、整数等)。
我正在寻找一个可以构建这些“模板”的框架/建议。这是一项网络工作,因此我们知道我们肯定会使用某种数据库。该技术尚未确定,但可能会在 PHP 和 PHP 之间进行。 。网。我们认为在现阶段,很多工作将在 SQL 中完成(并且想看看这是否是一个值得追求的好主意)
是否有任何我可以使用的示例应用程序?以前有人做过这种性质的工作吗?
谢谢!
Am looking for some advice on the design of an application. As I'v signed an NDA I can't reveal too much about the actual business but will try to explain the requirement.
Essentially, we want to develop an application that will take a decision based on a customers credit profile. We will take data from a suitable provider (eg. Experian) and match it against the business rules. If the customer meets those rules, they get a green flag to be passed to the next process (and possibly another system, but am not worried about that for now); if not, they will get a red flag and not get passed on.
The client has indicated that they would like the business rules to be modifiable i.e. something that they can amend and thats not hard coded or stuck in the code somewhere. They have defined a set of rules as a 'template'. The system will only have one active template at a time, but over its lifetime might have many templates.
These rules would be composed of multiple operators checking different data types. Each phase/step of the rules would be allocated a certain weight. An example of a 'template' would be
- Is the customer male = 10 points
Is the customer female = 20 points
Is the customer between 25 and 35 years of age? = 20 points
Is the customer less than 25 years of age? = 10 points
Does the customer earn between $30000 and $50000 per annum = 20 points
So as you can see, there are comparisons/operators of various types (boolean, integer etc).
I am looking for a framework/advice on which I can build these 'templates'. This is a web job, so we know that we'll definitely be using a DB of some sort. The technology has not yet been decided, but would probably be between PHP & .NET. We think at this stage that a lot of this will be done in SQL (and would like to see if this is a good idea to pursue)
Are there any sample applications out there that I could go through? Has anyone done work of this nature before?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为您正在寻找业务流程执行语言。
I think you are looking for Business Process Execution Language.
我不认为让您的客户在 SQL 中编写自己的规则然后执行这些规则是一个明智的想法。首先,您可能会遇到安全问题(例如,如果他们访问不应该访问的数据库部分),并且您透露了太多的实现细节(如果他们开始使用特定于 DBMS 的操作,而您后来决定替换数据库管理系统)。
根据您想要在此处投入的工作量,这对于特定于域的人来说听起来像是一份不错的工作语言。 @Ozair 建议使用 BPEL,但这可能有点过头了。
I don't think that letting your customers write their own rules in SQL and then executing those is a smart idea. Firstly, you could run into security issues (for instance, if they access parts of the database they shouldn't), and you reveal too much implementation specifics (what if they start using DBMS-specific operations, and you later decide to replace the DBMS).
Depending on the amount of work you want to put in here, this sounds like a good job for a Domain Specific Language. @Ozair suggested BPEL, but it might be overkill.
如果您的所有规则都那么简单,您可以使用类似以下内容的内容:
...因此
Rule
与Template
关联,并指定要应用的比较类型(例如 ' GreaterThanMin'、'lessThanMax'、'exactValue'、'insideRange' 等)到给定字段。然后你可以这样做:If all your rules are that simple, you could use something like:
...so a
Rule
is associated with aTemplate
, and specifies a comparison type to apply (like 'greaterThanMin', 'lessThanMax', 'exactValue', 'insideRange', etc.) to a given field. Then you can do: