Backward Chaining VS Forward Chaining
1)Which approach is better ,Backward Chaining or Forward Chaining? justify.
2)How can the developers ,at design time, choose from either of these? Consider example of A=B+C.
***Moderator Edit: Vidyaranjan | Updated Categories***
-
Likes (5)
-
Accepted Solution

Hi Salman,
I am not suggesting to exclude declare expressions. Declare expressions are better and to be used based on application requirements.
In the above details I am just suggesting to choose forward / backward chaining cleverly so that it takes less processing time.
In case of above expression: A=B+C
if B and C are changing frequently better to choose backward chaining. So that expression triggers only when A is used.
or
if A is used many places for display and calculations better to choose forward chaining. So that when input changes target is calculated and ready for usage.
**Need to choose between the 2 cleverly based on input / target property utilization**.
Hope it is clear.
Thanks,
Ananda Bhat

Hello Salman,
Forward chaining is executed when the value of any of the source properties change.
Backward Chaining mode executes when the target property is referenced. Backward chaining is supported only for declare expressions.
Based on your requirement, we need to choose the Forward or backward chaining. For your example i.e. A=B+C, we need to use forward chaining. when property B and C value changes we need to calculate A value.
Regards,
Praveen
Below link will help in great details in evaluating pros and cons for both approaches along with detailed explaination.

Hi Salman,
The expression A=B+C can be configured to use forward chaining or backward chaining.
It has to be decided depending on how frequently these values change and used.
If values of B and C changes frequently and in future steps you are using A in few places, then better to use backward chaining(ie calculate value of A when ever it is used).
If input values are not changing frequently and target property is used frequently in the application then you can go for forward chaining(ie calculate A when ever input changes).
Hope it helps.
Thanks,
Ananda Bhat

Hi Ananda Bhat.
Thanks for your reply. But, I have a question here.
Above, you said,
"If values of B and C changes frequently and in future steps you are using A in few places, then better to use backward chaining(ie calculate value of A when ever it is used)." And
"If input values are not changing frequently and target property is used frequently in the application then you can go for forward chaining(ie calculate A when ever input changes)."
So, by these two statements, you are suggesting to execute Declare Expression rule as less as possible to improve performance, right? Is my understanding correct?
If yes, then a question. What chaining to go for when if input values are changing frequently and target property is used frequently in the application?
Accepted Solution

Hi Salman,
I am not suggesting to exclude declare expressions. Declare expressions are better and to be used based on application requirements.
In the above details I am just suggesting to choose forward / backward chaining cleverly so that it takes less processing time.
In case of above expression: A=B+C
if B and C are changing frequently better to choose backward chaining. So that expression triggers only when A is used.
or
if A is used many places for display and calculations better to choose forward chaining. So that when input changes target is calculated and ready for usage.
**Need to choose between the 2 cleverly based on input / target property utilization**.
Hope it is clear.
Thanks,
Ananda Bhat