You might want to do so to make sure that future changes in one part will not unintentionally change the other part. for example consider
Do_A_Policy()
{
printf("%d",1);
printf("%d",2);
}
Do_B_Policy()
{
printf("%d",1);
printf("%d",2);
}
Now you can prevent "code duplication" with function like this:
first_policy()
{
printf("%d",1);
printf("%d",2);
}
Do_A_Policy()
{
first_policy()
}
Do_B_Policy()
{
first_policy()
}
However there is a risk that some other programmer will want to change Do_A_Policy()
and will do so by changing first_policy() and will cause the side effect of changing Do_B_Policy(), a side effect which the programmer may not be aware of.
so this kind of "code duplication" can serve as a safety mechanism against this kind of future changes in the program.