c# - How can i structure a program (proces) with a very high number of IF statements -
i have create program kind of complex proces. well, process not complex, there lot of variables control process. can't in detail tell process, i've made one, has same load of if's:
the process is: should stop iron melt oven or not. we've got these parameters: if temp goes above 800 degrees celcius, stop except, when expect cool water available oven 2 in next 20 minutes, can continue
except, when temp rises 10 degrees in next 10 minutes, can't wait 10 minutes cold water, have stop.
except, when temp goes down reason 790-800 degrees 5 minutes, add 5 minutes time need cool water.
except, when temp goes down reason 780-790 degrees 5 minutes, add 5 minutes time need cool water.
etc. etc.
you can think of 20 except / if / then's
in our process have > 50 situations, 1 goal: should machine stop or not.
i must don't have many situations 1 goal/issue (namely: stop machine or not), , timebound: if happening 10 minutes then...., , have calculate situation every minute again.
is there way program in smart way?
(and unit test, because have loads , loads of combinations seperate unit tests guess?)
some problem spaces dont fit oop principle elegantly. sounds situation can managed better in rule based paradigm (especially when rules change). here exampe of rule based framework .net: http://www.codeproject.com/kb/cs/drools_netprimer.aspx
Comments
Post a Comment