What Data structure for Reputation Rules in C# (like stackoverflow)
Posted
by optician
on Stack Overflow
See other posts from Stack Overflow
or by optician
Published on 2010-04-21T12:23:12Z
Indexed on
2010/04/21
12:33 UTC
Read the original article
Hit count: 294
I am currently building a system which will have entities that will have scores like reputation etc..
I will have a service that will check for certain rules having been triggered, and will perform certain logic if they are triggered.
Previously I have used say an Enum for doing this when I have only had to store an id and a description.
public enum ShoppingCratCalculation
{
PartialCalculation = 1,
CompleteCalculation =2
}
But in this situation I want to carry more information, such as the modification to reputation, all in one place.
I'm essentially asking what data structure would be best suited to storing this information, for each rule in the system.
1. Description = string ("User forgot to write a review")
2. DB id = int (23)
3. Rep score modification = int (-5)
Maybe a little class (Rule) with these as properties , and then just a list?
Does anyone have any best practice suggestions for this kind of struct?
© Stack Overflow or respective owner