设计一个徽章系统,其中火的商业逻辑?在code或存储过程?或两者? [英] designing a badge system, where to fire business logic? In code or stored procedures? or both?

查看:118
本文介绍了设计一个徽章系统,其中火的商业逻辑?在code或存储过程?或两者?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您要建造一个徽章系统类同怎么这么办吧,你能把逻辑/业务层直接在数据库中(通过存储过程,计划的SQL作业)或将其放在服务器端?

If you were to build a badge system similiar to how SO does it, would you put the logic/business layer in the database directly (via stored procedure, scheduled sql jobs) or put it in the server side?

这是我能想到的,你必须:

From what I can think of, you have to:


  1. 列表徽章,涉及到当前用户操作

  2. 检查用户是否有徽章已经与否

  3. 插入徽章用户

潜在选项


  1. 在调用存储过程等Web应用程序的业务逻辑。

  2. 仅用于存储过程

  3. 运行每隔x分钟
  4. SQL服务器作业

  5. Windows服务运行每隔x分钟

会这些的组合被要求?我认为它会因为一些徽章是基于里程碑对于给定的问题,也许一个批处理作业是更好的?

Would a combination of these be required? I think it would since some badges are based on milestones for a given question, maybe a batch job is better?

更新

一个系统,你可以修改系统徽章,然后重新运行整个徽章链接为大家甚至会更好。即说你改变了逻辑一些徽章,现在你必须重新把它应用到所有的问题/答案/票/等。

A system where you can modify the badge system, then re-run the entire badge linking for everyone would be even better. i.e. say you change the logic for some badges, now you have to re-apply it to all the questions/answers/votes/etc.

有趣的问题来解决!

推荐答案

我建议把所有的业务逻辑在业务层。我推荐这几个原因:

I would recommend putting all business logic in the business layer. I recommend this for a few reasons:


  • 保持业务逻辑在一
    语言/地点

  • 可扩展性 -
    您可以划分数据,实施
    不同的缓存机制等。

  • 关注
  • 分离 - - 让你的数据库做它最好的... ...存储数据,让你的编程语言对这些数据作出决策

这篇关于设计一个徽章系统,其中火的商业逻辑?在code或存储过程?或两者?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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