Database Architecture for "Badge" System & Arbitrary Criteria (MySQL/PHP) -


quick-question:

In short, I'm confused with how to design Such a database which allows creation of an uncertain badge rule without requiring structural changes in user-tables already in the database.

Archiving badge title, criteria, etc. What does that table look like? Badge_id (1)

  • Badge_title (badges of 10)
  • Badge_image (10k.jpg)
  • Badge_Getria ([ Post]> = 10000)
    ...
  • winded-question:

    I apply badge system to myself I want to do personal projects, but to get some advice on the advice of how to do it would be best, I am reading some questions about badges-systems, but databases do not look more architectural.

    Badges that are based on user-number (hypothetics "badges of 10") will appear very directly in front of any event affecting the reputation of users (exceptions, downwots, answer-approved etc.) Will call a method to review the new reputation and potentially provide a badge.

    The system runs very straight forward, but what does it look like as a database for administrators who want to make small badges under the road - some of which are different parameters , And not only the user's reputation.

    The user-reputation is likely to have a value within the user's record but ideally, do not you want to add new fields to the user table when creating new badges? For example, "Edit 100 Entries" Badge - You will not be able to create a new column "entries_associated" within the user table, do you?


    Note: I'm not saying how to associate badges with users. I'm not saying how to provide badges (which will be programmed)

    That the criteria of the badge can be arbitrarily complex, I do not think you can store it in the database table divided into "simple" data elements. Trying to write a "rule engine" that can control arbitrarily complex parameters, is basically taking you down the path to rewriting all the tools present in your programming language.

    If you know in advance that you want the badges to be limited to only a few fields (i.e. the badge is only based on reputation or edits or a few numbers), you can store those people in a simple table. Alternatively, you can use any type of DSL to write your "rules":

    , But you're parse to parse the rules Some with the order to execute it can also have these rules. Depending on the complexity you want in your DSL, this can not be a trivial task. It seems that the way you are going to have a benchmark column (possibly plain text) in your question, such as "[prestige]> 1000 "or" [post]> 5 "you still have to parse and execute those rules and the complexity of writing something to do this depends on how complex you are to those rules.

    I would like to read daily WTF daily for information about this approach to the pain.


    Comments

    Popular posts from this blog

    c++ - Linux and clipboard -

    What is expire header and how to achive them in ASP.NET and PHP? -

    sql server - How can I determine which of my SQL 2005 statistics are unused? -