4.4 John Fultz collected on dynamics

Module variables should *never* appear inside Dynamics or 
Manipulates internal to that Module. 
 
To be clear with some examples (all using Dynamic, but they could equally well 
use Manipulate, which is implemented using Dynamic)... 
 
(* OK *) Dynamic[Module[{a}, a]] 
(* OK *) Module[{a}, 
                (* expression involving a*); 
                Dynamic[(* expression *not* involving a *)] 
(* BAD *) Module[{a}, Dynamic[a]]
 

By John Fultz on math group, jan 24/2012

"Generally, you should construct controls so that they’re not inside Dynamics that will trigger while you’re interacting with those controls, since this can create instability"

By John Fultz on math group, feb 3/2012

"CDF files which you expect to deploy cannot rely on Shift+Enter evaluations to prime the pump. You need to make sure that all of the code dependencies are in the dynamic evaluations somewhere. Some possible ways of doing this, all of which have been discussed at various points on MathGroup, include:

* Using the Initialization option of Dynamic, DynamicModule, or Manipulate

* Using the SaveDefinitions option of Manipulate

* Adding code to the NotebookDynamicExpression option of the notebook (if it’s initialization code, then wrapped in Refresh[#,None]& to prevent it from evaluating more than once per session).

* Not such a good idea for function definitions, but if you simply have code that needs to run before Dynamic code runs, nesting a DynamicWrapper around it might be appropriate, too."