-
Notifications
You must be signed in to change notification settings - Fork 655
Age: Guard vs. Delay
When designing a module, and you want something to happen at a specific age, when should you use Guard
and when should you use Delay
?
Delay
should be used when you want a specific amount of time to pass between two events. You do not care how old the patient is before or after, you only care that a second event is delayed some amount of time. The time can be exact (e.g. 3 days) or a range (e.g. 1-2 weeks).
Guard
should be used when you want to put in a "Stop Sign" in the module, and the patient cannot proceed until some logical condition is met. For example, this condition might be based on age (e.g. wait until the patient is 18 years old), or date (e.g. wait until the year is 1918), or something else like medication (e.g. wait until the patient is prescribed an opioid).
So, use Delay
when you want to specify an amount of time to wait, and use Guard
when you want to wait for something to occur. Keep in mind that the something you are waiting to occur might never happen.