Avoid (where possible). Most of the time it is possible to avoid the worst offences. If forced to use side-effecting predicates then try to limit their distribution throughout the code. It is a good idea to have one user-defined predicate within which a clause is asserted, one in which a clause is retracted, one to write out a term on the screen etc.