I have been trying to find a proper way to represent the above data flow (this is just a small case), and I'm not sure if I found a good way to do it. Our current implementation just evaluate all the previous data like:
(if user.isMarried && user.age > 23 & ....)
, so is very hard to maintain.
Basically, what I need is a way to calculate the next step based on current input and previous conditions. I've been thinking about a finite state machine, but my main issue is that it will not only depend on the input, but previous data already answered.
It also came to my mind using something like a decision tree, but I can't represent it properly. Any light on the subject would be really appreciated.
Note: Check that the blank questions doesn't depend on the input, but on previous answers (married or not).
boolean isMarried(survey);
.