I will regularly read some discrete states, and applying some rules to differences in states I will report some errors. Rules can be changed in time.
What are best-practices to solve such a problem?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’d also use the singleton pattern, apart from the Strategy one.
One possible implementation (though this is quite open, if you want a flexible set of rules you shoud use another class for the “Rule” entity. However, this way it is simpler to understand):
Of course this is an indication of the header(s). The implementation files are missing. Hope this helps.