I am implementing a validation system which has some constraints, there are category of users let's say 30 and for each category there are number of rules. Actually there are 100 different rules.
I have a multimap which maps given user_category_id to list of rule_id's.
Constraint 1. The rule should only execute if its enabled for that user category. Rules are differently configured based on whether its for update or insert.
Here I am thinking of using Strategy pattern to validate the rules.
From the context I will pass as parameter the (user_category_id, rule_id's list, and whether its for Update or insert). Each rule, I feel, should be a separate class with methods to get its rule id value, execute method for the given user category and logic based on whether its for update or insert.
So the context class will have the multimap for the user_category_Id to the rule_id. and the value for whether the rule validation is being done for update or insert.
In the IStrategy interface will be having the signature of the method. But what would be the return type of the method I am not sure of. There is a Response class which is encapsulating my response and is sent to the user.
Last part is how to design the rule logic. There are hundreds of different rules. How to go about this task? Should I encapsulate all the 100+ rules into separate classes? I feel I should be using Strategy pattern but I am not clear about how to carry out the implementation? I need some guidance. Let me know if some more info is required for the above design work. Any suggestion and guidance for improving the above design will be highly appreciated.