# DynamicModule endlessly updating unexpectedly

I've encountered an error using DynamicModule to show results of some numeric or symbolic solving algorythms (I've tried NMaximize, Minimize, NMinValue). If a dynamic function (here it is named happa) uses such an algorithm, and influences the output, DynamicModule updates continuously. The following examples demonstrate the problem.

Can somebody explain why example #3 updates continuously, without any input?

1. This example behaves as expected, printing "oops" once per every interaction with SetterBar:

DynamicModule[{happa, dummy},
happa[] := (dummy + 2);
{SetterBar[Dynamic[dummy], Range], Dynamic[Print["oops"]; happa[]]}]

2. Now add a pointless algorithm in happa definition. This example behaves unexpectedly, printing "oops" twice per every interaction with SetterBar, suggesting that it updates twice:

DynamicModule[{happa, dummy},
happa[] := (Minimize[{Sin[x], x >= 0 && x <= 1}, x]; dummy + 2);
{SetterBar[Dynamic[dummy], Range], Dynamic[Print["oops"]; happa[]]}]

3. Now add two pointless algorithms in happa definition. This example behaves unexpectedly, printing "oops" continuously, even without any interaction, suggesting that it is updating continuously:

DynamicModule[{happa, dummy},
happa[] :=
(Minimize[{Sin[x], x >= 0 && x <= 1}, x];
Minimize[{Sin[x], x >= 0 && x <= 1}, x]; dummy + 2);
{SetterBar[Dynamic[dummy], Range], Dynamic[Print["oops"]; happa[]]}]

4. Now declare happa as a variable with delayed evaluation. This example behaves as expected, printing "oops" once per every interaction with SetterBar:

DynamicModule[{happa, dummy},
happa :=
(Minimize[{Sin[x], x >= 0 && x <= 1}, x];
Minimize[{Sin[x], x >= 0 && x <= 1}, x]; dummy + 2);
{SetterBar[Dynamic[dummy], Range], Dynamic[Print["oops"]; happa]}]